Home>Article>Development Tools> Why is the txt garbled when I open it with vscode?

Why is the txt garbled when I open it with vscode?

angryTom
angryTom Original
2019-11-16 14:18:42 8739browse

Why is the txt garbled when I open it with vscode?

Why is the txt garbled when I open it with vscode?

Because txt uses gb232 encoding format, vscode The file is opened using UTF-8 encoding, and inconsistent encoding results in garbled characters.

Why is the txt garbled when I open it with vscode?

Solution:

Click the encoding button in the lower right corner (UTF-8 in the picture), then select Operation and pass Reopen with Encoding

Why is the txt garbled when I open it with vscode?

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

Why is the txt garbled when I open it with vscode?

and then the character encoding will be 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 solution is to click File->Preferences->Settings, and then enter the user settings on the right:

"files.autoGuessEncoding": true,

Insert this line of content and save it.

After adding this setting, VSCode will try to guess the character set encoding when opening the file. Switch to the correct encoding without having to choose the encoding yourself.

Related recommendations: "vscode usage tutorial"

The above is the detailed content of Why is the txt garbled when I open it with vscode?. 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