Home >Development Tools >VSCode >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.
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.
PHP Chinese website has a large number of free vscode 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!