Modify the DOS window encoding in the window to utf8

Source: Internet
Author: User

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.

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.