DOS中通过chcp修改console code page
· 2 min read
UTF-8 格式的日志文件, DOS 中通过 type 命令查看时显示乱码:
C:\app\Manager\Log\RootManagerServer>type Root_20200527_135730_Trace.html
1590559051 0 0 Trace 0 0 Bind Port:Listen:8800<br>
1590559051 0 0 Trace 0 0 鏈嶅姟鍣ㄧ洃鍚鍙?8800<br>
1590559051 0 0 Trace 0 0 Bind Port:Listen:9800<br>
1590559051 0 0 Trace 0 0 瀹㈡埛绔洃鍚鍙?9800<br>
通过 chcp 命令修改 code page 为 65001 后显示正常:
C:\app\Manager\Log\RootManagerServer>type Root_20200527_135730_Trace.html
1590559051 0 0 Trace 0 0 Bind Port:Listen:8800<br>
1590559051 0 0 Trace 0 0 服务器监听端口:8800<br>
1590559051 0 0 Trace 0 0 Bind Port:Listen:9800<br>
1590559051 0 0 Trace 0 0 客户端监听端口:9800<br>
DOS 命令行中支持的 Code Page:
| 代码页 | 国家/地区或语言 |
|---|---|
| 437 | United States |
| 850 | 多语言 (拉丁文我) |
| 852 | 西里尔语 (俄语) |
| 855 | 西里尔语 (俄语) |
| 857 | 土耳其语 |
| 860 | 葡萄牙语 |
| 861 | 冰岛语 |
| 863 | 加拿大法语 |
| 865 | 北欧 |
| 866 | 俄语 |
| 869 | 现代希腊语 |
| 65001 | UTF-8 |
chcp 文档: https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/chcp
