Home>Article>Development Tools> What to do if vscode utf-8 Chinese garbled characters

What to do if vscode utf-8 Chinese garbled characters

藏色散人
藏色散人 Original
2020-04-02 09:42:17 10851browse

What to do if vscode utf-8 Chinese garbled characters

What to do if vscode utf-8 Chinese garbled code? VS code encoding settings/file garbled solution

First of all, by default, we use VS Code to open a utf-8 encoded file and a gb2312 encoded file. The gb2312 file was garbled during the period.

Recommended learning:vscode tutorial

VSCode usually defaults to UTF-8 encoding.

What to do if vscode utf-8 Chinese 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

What to do if vscode utf-8 Chinese 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.

What to do if vscode utf-8 Chinese 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.

What to do if vscode utf-8 Chinese 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.

What to do if vscode utf-8 Chinese 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.

What to do if vscode utf-8 Chinese garbled characters

The above is the detailed content of What to do if vscode utf-8 Chinese 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