Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to solve the garbled code and coding problem of command line in windows

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

In this issue, the editor will bring you how to solve the garbled code and coding problems on the command line in windows. The article is rich in content and analyzes and describes for you from a professional point of view. I hope you can get something after reading this article.

Solve the problem of garbled code and coding on the command line

Command chcp

Features:

Displays or sets the active code page number

CHCP [nnn]

Nnn specifies the code page number.

Type the CHCP to display the active code page number without arguments.

Nnn specifies an existing system character set, which is defined by the COUNTRY command in the CONFIG.SYS file.

Under DOS, you can set up the code page through the mode command.

Selected code page: MODE CON [:] CP SELECT=yyy

Code page status: MODE CON [:] CP [/ STATUS]

Press Windows+R, and then type cmd or command to open the command prompt.

For example, enter: mode con cp select=936, which means that simplified Chinese is displayed. If you enter mode con cp select=437, it will show MS-DOS American English, while the Chinese display will be?

MS-DOS provides character sets for the following countries and languages:

Code page description

1258 Vietnamese

1257 the language of Baltic

1256 Arabic

1255 Hebrew

1254 Turkish

1253 Greek

1252 Latin 1 character (ANSI)

1251 Cyrillic

1250 Central European languages

950 traditional Chinese

949 Korean

936 simplified Chinese (default)

932 Japanese

874 Thai

850 languages (MS-DOS Latin1)

437 MS-DOS American English

/ / add

Dos directive:

Chcp 65001 is replaced by a UTF-8 code page

Chcp 936 can be switched back to the default GBK

Chcp 437 is American English.

How to display UTF-8 characters in a DOS window

In Chinese Windows systems, if a text file is UTF-8 encoded, the contents of the file will not be displayed correctly in the CMD.exe command line window (the so-called DOS window). By default, the code page used in the command line window is Chinese or American, that is, the code is a Chinese character set or a western character set.

If you want to display UTF-8 characters correctly, you can follow these steps:

1. Open the CMD.exe command line window

2. Change the code page by chcp command. The code page of UTF-8 is 65001.

Chcp 65001

After doing this, the code page is changed to UTF-8. However, UTF-8 characters are still not displayed correctly in the window.

3. Modify the window properties and change the font

Right-click on the command line title bar, select "Properties"-> "font", change the font to True Type font "Lucida Console", and then click OK to apply the properties to the current window.

At this point, use the type command to display the contents of the UTF-8 text file:

Type filename.txt

4. The above actions can not completely solve the problem, because the content displayed may not be complete. You can minimize and then maximize the command line window, and the contents of the file will be fully displayed.

This is how to solve the command line garbled and coding problems in windows shared by Xiaobian. If you happen to have similar doubts, please refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report