Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to write Chinese characters by vscode

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

The editor will share with you how vscode writes Chinese characters. I hope you will gain a lot after reading this article. Let's discuss it together.

How does vscode write Chinese characters?

Chinese windows under the cmd default use GBK coding, every time needed in the VSCode terminal input command: chcp 65001, switch the code page to the use of UTF-8 can solve the Chinese code problem, but this method is too troublesome, every time to enter the terminal to enter the command, is there a permanent solution? Of course there is.

The console code page permanently modified to VSCode is 65001:

In VSCode, copy the following three lines by opening "File"-"preferences"-"Settings" and setting it in setting.json:

{"editor.fontSize": 18, "terminal.integrated.shellArgs.windows": ["/ K chcp 65001 > nul"], "terminal.integrated.fontFamily": "Lucida Console",} / K chcp 65001 > nul means to set the encoding to 65001 when running cmd; > nul is to avoid changing the encoding on the console, otherwise active code page: 65001 will be output.

At the same time, two colored eggs are given, such as:

Editor.fontSize: 20 (change the font size to 20); terminal.integrated.fontFamily: "Courier New" (change the font to "Courier New").

This can be filled in according to your own needs, of course, if you don't need it, you don't have to write it.

If the above method goes wrong, you can try the

"terminal.integrated.shellArgs.windows": ["- NoExit", "/ c", "chcp 65001"]

Of course, if you can fix it by modifying the GBK or UTF-8 on the lower right, there is no need to choose the above two methods:

It is found that if it is changed to UTF-8, it is normal to run through Run Code, but when it comes to F5 debugging, the black box that pops up is garbled, and if it is changed to GBK, then F5 debugging is normal, Run Code is garbled, anyway, you can't have both, you can choose. To sum up, the Run Code run has been changed to UTF-8,F5 debug run and changed to GBK. Of course, this is not absolute. Let's take a look at what "terminal.integrated.shellArgs.windows" modifies.

After reading this article, I believe you have a certain understanding of how to write Chinese characters in vscode, want to know more about it, welcome to follow the industry information channel, thank you for reading!

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.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report