Display UTF-8 characters in the cmd window

Source: Internet
Author: User

There is a file that is UTF8 encoded in the Eclipse attribute and contains Chinese:

But when you view this file in the Windows console (for convenience, I copied the file to the desktop), it is garbled:

C:\users\002778\desktop>type abc.sqluse abc;insert into ' School ' VALUES (1, ' Åœ 椾 with 澶 heaven ', ' åœ 椾 containing ning intestine å worm 潙 åœ 楀 ぇ Aachen? 7 å è¡#̈亞?, ' 01062752114 ', ' Phenomena phone executive å?), (2, ' Anisakis attacker natural 澶 heaven ', ' åœ 椾 with ning if pounded åœ å 潙 ', ' 01062785001 ', ' 澶 parameters ACI 堝?), (3, ' Å 椾 containing 澶 heaven ', ' Cha next 嫃 eyewear 佸 leaflet Bang Chinese Torreya result ゼ åœ bake 眽 å è¡#̈亞 h alum 22 Å è¡#̈亞?, ' 02583593186 ', ' ACI lunar 獜 '), (4, ' Juan Ricoh Bang-Bake 皯 澶 heaven ', ' åœ 椾 with ning if ramming åœ å 潙-澶 worm, ' 01062514305 ', ' ц59 å è¡#̈亞 aci lunar?), (5, '  ' â#̈ã 澶 Heaven ', ' departure chairman Wilson slow eyewear 佸 desired visits-Hi Athletics pickaxes indent mei å list alum 422 å è¡#̈亞?, ' 05922186110 ', ' Chain 卞磭 Yue? ';

So how do you get cmd to display these UTF8 encoded characters? Here are some things to know about:

CHCP command

CHCP is a command in MS DOS that is used to display or set the active code page number . Usage is:

C:\USERS\002778\DESKTOP>CHCP/? Displays or sets the active code page number. CHCP [nnn] nnn Specifies the code page number. Type CHCP with no parameters to display the active code page number.

For example, in the default CMD window, we enter CHCP, which will appear similar to the following:

C:\USERS\002778\DESKTOP>CHCP Activity code page: 936

The 936 here means that the Simplified Chinese (GB2312) encoding is currently in use. For more code page numbers, please check here .

UTF8 encoding

You also need to understand some of the coding knowledge, in order to complete support UTF8 work, you need to know at least UTF8 code page number: 65001. More about the content of the code, do not repeat here, please find the relevant content.

With these two points of knowledge, the next step is to make it easier for CMD to support UTF8.

1. Run cmd;

2. Input chcp, enter to view the current encoding;

3. Enter chcp 65001 to output:

Active Code page:65001c:\users\002778\desktop>

4. If this is the case, you may still not be able to support the normal display of UTF8, you should also right-click on the form and select Properties to set the font. In the previous 936, there is no lucida Console this font, but after switching to 65001, you can see:

6. Select Lucida Console and apply only to this form, confirm, and then try again:

This will use CMD to successfully display the UTF8 characters.


Reference page:

Http://blog.useasp.net/archive/2012/04/24/how_to_use_UTF8_encoding_in_Windows_CMD.aspx

https://msdn.microsoft.com/en-us/library/windows/desktop/dd317752 (v=vs.85). aspx

Display UTF-8 characters in the cmd window

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.