Setting the environment encoding in the CMD command line under Windows

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.