CMD defaults to gbk, so if the output string is normal, then the output should be GBK characters. First modify the file encoding, and indicate the encoding of the file in the header of the python file, and then write the file and it will be normal
The garbled characters are only related to the encoding of your text editor. You are using Atom. In the lower right corner there is UTF-8 , click and select Chinese (GBK)
Use git-bash to search and download one
CMD defaults to gbk, so if the output string is normal, then the output should be GBK characters. First modify the file encoding, and indicate the encoding of the file in the header of the python file, and then write the file and it will be normal
Modify test.py like this,
请把编码改为gbk
:The garbled characters are only related to the encoding of your text editor. You are using Atom. In the lower right corner there is UTF-8 , click and select Chinese (GBK)
Modify cmd default file encoding