Window notepad, edited txt file, why is it garbled when transmitted to github, and not garbled after mac cloning?

Mar.09,2021

text files are not encoded in utf-8 format by default. You can use nodepadePP to modify the encoding format of text to utf-8 and then upload it to github.


character encoding. Modify it to UTF-8


system notepad encoding is ANSI,. You can refer to the following article to change the coding to UTF-8
https://blog.csdn.net/shenqua.
or edit it directly with an editor. The common ones are sublimetext (highly recommended). NotepadPP et al
a href= "https://www.sublimetext.com/3" rel=" nofollow noreferrer "> https://www.sublimetext.com/3
https://www.sublimetext.com/3dev


Don't use Windows notepad to edit any code

because it will add a BOM header (special character, invisible) to the file header after it is saved, which will result in a file decoding error (because it is usually saved as UTF-8 without BOM). If you use a text editor with the ability to adjust the encoding, you should also see the options "UTF-8/UTF-8 without BOM" and "UTF-8 with BOM".

as to why there is a BOM, you can understand that it is a tag set to identify different coding standards (otherwise you will have to read the entire file to determine the encoding it uses), just don't touch it in the programming field. As for notepad, you can either install a substitute without BOM injection (such as NotepadPP), or just open it with notepad without saving it.

Menu