How to solve the issue of Chinese characters appearing as gibberish in the output window of VS Code?
In VS Code, the issue of garbled text in the output window is usually caused by incorrect encoding settings. The solution is as follows:
- Click the “Settings” button on the VS Code toolbar (gear icon), then choose “Preferences” > “Settings”.
- In the settings page search box, type “output” to locate the “Output: Encoding” option.
- Choose a character encoding that suits you, common encodings include UTF-8 and GBK.
- If you’re not sure which encoding to choose, you can try different ones until the output window displays Chinese characters correctly.
- Close and reopen VS Code to see if the Chinese characters in the output window are displayed properly.
If the above method does not solve the problem, you can also try the following method:
- Check if your code files are saved in the correct encoding format. For example, if your code files are saved in UTF-8 encoding but the encoding format is set incorrectly in VS Code, Chinese characters in the output window may appear as gibberish.
- Verify that your operating system language settings are correct. If your operating system language is set to a language other than Chinese, the Chinese characters in the output window may appear as garbled text.
- Make sure that the correct Chinese fonts are installed in your system. Sometimes, if the correct Chinese fonts are not installed, Chinese characters in the output window may display as squares or other garbled characters.
- Change the active code page to 936 and then …
- If you are using any plugins or extensions, try disabling them and then reopening VS Code to see if it resolves the issue of garbled characters.
I hope the above methods can help you resolve the issue of Chinese garbled characters in the output window of VS Code.