vscode terminal garbled code
The VSCode terminal actually calls cmd.exe, so when Chinese garbled characters appear here What needs to be solved at this time is the encoding setting problem of cmd.
You can check the encoding settings of cmd through the chcp command. The code page number of GBK2312 is 936, and then change it to the encoding of utf-8. The corresponding code page number of utf-8 is 65001, so execute chcp 65001 to set the cmd encoding to uft-8, thus solving the garbled code problem
1. Check the original encoding
2. Execute the chcp 65001 command
For the above solution, you need to enter the command in the VSCode terminal every time: chcp 65001, This method is too troublesome. You have to enter commands every time you enter the terminal. Is there a permanent solution? Of course there is.
In VSCode, open "File" - "Preferences" - "Settings", then set in setting.json, and copy the following three lines into it:
{ "terminal.integrated.shellArgs.windows": ["/K chcp 65001 >nul"], // 以下两个可选 "terminal.integrated.fontFamily": "Lucida Console", "editor.fontSize": 18 }
/K chcp 65001 >nul means to set the encoding to 65001 when running cmd;
>nul means to avoid The console outputs information about modifying the encoding, otherwise it will output active code page: 65001;
The following two configuration files are optional:
editor.fontSize: 20 (modify the font size to 20);
terminal.integrated.fontFamily;"Courier New"(the font is changed to "Courier New").
Related recommendations: "vscode Usage Tutorial"
The above is the detailed content of vscode terminal garbled characters. For more information, please follow other related articles on the PHP Chinese website!