Home>Article>Development Tools> How to solve vscode garbled characters

How to solve vscode garbled characters

爱喝马黛茶的安东尼
爱喝马黛茶的安东尼 Original
2019-12-06 15:02:26 13294browse

How to solve vscode garbled characters

First of all, by default, we use VS Code to open a utf-8 encoded file and a gb2312 encoded file, of which the gb2312 file is garbled.

VSCode usually defaults to UTF-8 encoding.

How to solve vscode garbled characters

One way is to click the encoding button in the lower right corner (UTF-8 in the picture), then select Operations and Reopen with Encoding

How to solve vscode garbled characters

Next, you can search in the supported encoding list. For this file that is already known to be encoded in GB2312, you can also type GB to search and click GB2312.

How to solve vscode garbled characters

Then the character encoding is normal after VSCode is refreshed. At this time, the encoding indicator in the lower right corner will change. At this time, the saved file will also be modified according to this encoding.

How to solve vscode garbled characters

Another method is to click File->Preferences->Settings, and then enter the user settings on the right:

"files.autoGuessEncoding": true,

As shown in the figure, Insert this line and save it.

How to solve vscode garbled characters

How to solve vscode garbled characters

After adding this setting, VSCode will try to guess the character set encoding when opening the file.

As shown in the picture, you can switch to a correct encoding without selecting the encoding yourself.

How to solve vscode garbled characters

PHP Chinese website has a large number of freevscode introductory tutorials, everyone is welcome to learn!

The above is the detailed content of How to solve vscode garbled characters. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn