If you do this using UTF-8 EncodingProgramWhen outputting Chinese characters, the results displayed in the Windows command line are garbled
Is it a program error? Feiyou
Next, let's take a look at how to modify the default command line encoding in windows, mainly through the chcp command!
If chcp is executed without parameters, the code of the current command line is returned.CodePage 936 is the Chinese GBK Encoding
Switch to the UTF-8 is also very simple to execute chcp 65001 this 65001 is the UTF-8 format code page
After switching, the font display may still be incorrect. You can adjust the font in the attribute at this time.
Finally, if you need to continue to keep the current settings when starting the command line next time, select the following options to confirm!
PS: Although UTF-8 sounds pretty good, it still seems to be a long time to coexist with GBK
After all, if you want your program to be opened on another machine by default, the correct results will be displayed.
I suggest you honestly use GBK encoding.