Home>Article>Development Tools> 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.
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
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.
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.
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.
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.
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!