As we all know, the cmd command line code under Windows is the encoding of the Windows system, that is, ANSI encoding or GBK encoding, so many of the applications we write, such as PHP to write utf-8 coded applications run under the command line will appear garbled, The reason is because the coding of the running environment uses its own encoding to resolve the program running results, and the program itself returns the encoding and parsing code inconsistencies, resulting in garbled occurrences.
In this case, we can resolve the encoding by setting the code of the CMD command-line environment in a uniform manner, as follows:
In the command line, a command is CHCP, which is used to display the current active code page number, or it can be understood as the encoding of the current environment, such as:
You can see that the code for the current ANSI code environment is 936
We can set the encoding of the active code page in this way by CHCP code number
UTF-8 encoded 65001, that we do: CHCP 65001 is set to UTF-8 encoded.
And then like this, the window and the font is obviously bigger, then we can also set a suitable font, click in the upper left corner, select "Properties", the default is the dot matrix font, and then set the font to: Consolas, click the OK button
And see if it looks much better.
This completes the Utf-8 encoding settings, if you need to set back, then the same reason first set the code name and then set the font back to OK
Setting the environment encoding in the CMD command line under Windows