In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
Editor to share with you how to do VSCode Chinese comments garbled, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
Problem situation:
When using VisualStudioCode for Python development
Because you need to set the format to utf-8 when running Python, it is common to set the encoding of the file to utf-8.
When it was opened again, it was found that a large number of Chinese comments turned into garbled codes.
For example:
By referring to the online solution:
Set to automatic recognition, no solution
Install gbk to utf-8, also did not resolve
Observation test:
No garbled code was found.
Found because every time it is opened, the compiler always opens it in GB2313 format
When running the program, you need to save the file as utf-8 before you can run it.
So in the configuration file, set each time to open it in utf-8 format and uniformly encode to solve the problem.
Step 1: locate the configuration file and open it
Step 2: add a statement to the configuration file
"files.encoding": "utf8"
Step 3: create a new file and solve the problem successfully
Note whether this is utf-8.
Close vscode and reopen it
If you have any questions, please feel free to leave a message under the comments.
1. Where is the statement added and where exactly is it added?
Before the problem is solved, there is a suggestion:
Since this problem is ultimately a coding problem, that is, Chinese, a better solution is to use English when annotating.
This can not only improve your English, but also avoid all kinds of coding problems and focus more on the code.
There are two ways to set VSCode, which are mouse operation and configuration file modification. You can choose one of these ways to modify it.
Entrance:
English version: file- > preferences- > settings
Chinese version: file (in the upper left corner)-> preferences-> Settings
You can see that there is a search box at the top.
-Mouse operation
You can enter "encoding" in the search box, see file encoding, and select utf-8, as follows:
-modify the configuration file
Enter "setting.json" in the search box and click the first option to enter, as follows:
Then, add a statement on the last line
The above is all the contents of the article "how to garble the comments in VSCode". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.