First of all, the C language running program is called cmd.exe, and the default encoding of Windows cmd is 936, which is gb2312.
Run->cmd-> Right-click on the head of the white window-> Properties to view it. UTF-8 is mainly used now, so the C program encoded with UTF-8 appears garbled. .
1. Modify the character encoding in cmd or vscode console
chcp
You can view the current console character encoding;
You can use chcp 65001 to modify the encoding. The following message will be displayed to indicate that the modification is successful, but it is only useful when it is currently open. The next time you open it, it will become gbk again. This method can correct the garbled code and see the effect when the code is already utf-8.
1. cmd console:
Enter the running program directory and run the program. For example, my c program is in d:/c/a.exe. After entering cmd.
d: cd c chcp 65001 a.exe
The program can output Chinese when the character encoding is utf-8.
2. vs code console
is the same as cmd, but with only 2 lines
chcp 65001 .\a.exe
, you can see the message in the terminal.
2. Modify the opening and saving method of the code in vs code
Save the code directly as gb2312. You can see the current file encoding method in the lower right corner of vs code. Click utf-8 to change the open and save method to gb2312.
Recommended tutorial: vscode tutorial
The above is the detailed content of vscode console garbled Chinese characters. For more information, please follow other related articles on the PHP Chinese website!

2022年了,该学会用VSCode debug了!下面本篇文章手把手带大家会习VSCode debug,希望对大家有所帮助!

本篇是VSCode配置文章,手把手教大家怎么在VSCode中配置使用 Geant4 和 Root,希望对大家有所帮助!

本篇文章扒拉一下vscode Prettier的选项,总结分享16个让你的代码变漂亮的属性,希望对大家有所帮助!

“工欲善其事,必先利其器!”,vscode作为前端开发的重要工具,其插件能大幅提升战斗力,精心收集12个插件,总有几款你还未曾拥有。

VSCode中如何开发uni-app?下面本篇文章给大家分享一下VSCode中开发uni-app的教程,这可能是最好、最详细的教程了。快来看看!

VScode中怎么开发置C/C++?怎么配置C/C++环境?下面本篇文章给大家分享一下Windows系统下VScode配置C/C++环境图文教程,希望对大家有所帮助!


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SublimeText3 English version
Recommended: Win version, supports code prompts!

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

Zend Studio 13.0.1
Powerful PHP integrated development environment

Atom editor mac version download
The most popular open source editor

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.
