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

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

angryTom
Release: 2019-11-16 14:18:42
Original
8871 people have browsed it

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,
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template