How to solve Chinese garbled code in vscode debugging c
I have been troubled by the Chinese garbled code in the c/c console of vscode for a long time. Some of the methods I found are not suitable for my situation at all, and then I finally found a method that works. In fact, it means configuring two places.
First of all, the C language running program is called cmd.exe, and the default encoding of window cmd is 936, which is gb2312. Run->cmd->right-click on the head of the white window->Properties. You can see that 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 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. vscode console:
is the same as cmd, but only has 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 vscode
Save the code directly as gb2312. You can see the current file encoding method in the lower right corner of vscode. Click utf-8 to change the open and save method to gb2312.
PHP Chinese website has a large number of free vscode introductory tutorials, everyone is welcome to learn!
The above is the detailed content of How to solve Chinese garbled code in vscode debugging c. For more information, please follow other related articles on the PHP Chinese website!

The difference between VisualStudioProfessional and Enterprise is in the functionality and target user groups. The Professional version is suitable for professional developers and provides functions such as code analysis; the Enterprise version is for large teams and has added advanced tools such as test management.

VisualStudio is suitable for large projects, VSCode is suitable for projects of all sizes. 1. VisualStudio provides comprehensive IDE functions, supports multiple languages, integrated debugging and testing tools. 2.VSCode is a lightweight editor that supports multiple languages through extension, has a simple interface and fast startup.

VisualStudio is a powerful IDE developed by Microsoft, supporting multiple programming languages and platforms. Its core advantages include: 1. Intelligent code prompts and debugging functions, 2. Integrated development, debugging, testing and version control, 3. Extended functions through plug-ins, 4. Provide performance optimization and best practice tools to help developers improve efficiency and code quality.

The differences in pricing, licensing and availability of VisualStudio and VSCode are as follows: 1. Pricing: VSCode is completely free, while VisualStudio offers free community and paid enterprise versions. 2. License: VSCode uses a flexible MIT license, and the license of VisualStudio varies according to the version. 3. Usability: VSCode is supported across platforms, while VisualStudio performs best on Windows.

VisualStudio supports the entire process from code writing to production deployment. 1) Code writing: Provides intelligent code completion and reconstruction functions. 2) Debugging and testing: Integrate powerful debugging tools and unit testing framework. 3) Version control: seamlessly integrate with Git to simplify code management. 4) Deployment and Release: Supports multiple deployment options to simplify the application release process.

VisualStudio offers three license types: Community, Professional and Enterprise. The Community Edition is free, suitable for individual developers and small teams; the Professional Edition is annually subscribed, suitable for professional developers who need more functions; the Enterprise Edition is the highest price, suitable for large teams and enterprises. When selecting a license, project size, budget and teamwork needs should be considered.

VisualStudio is suitable for large-scale project development, while VSCode is suitable for projects of all sizes. 1. VisualStudio provides comprehensive development tools, such as integrated debugger, version control and testing tools. 2.VSCode is known for its scalability, cross-platform and fast launch, and is suitable for fast editing and small project development.

VisualStudio is suitable for large projects and Windows development, while VSCode is suitable for cross-platform and small projects. 1. VisualStudio provides a full-featured IDE, supports .NET framework and powerful debugging tools. 2.VSCode is a lightweight editor that emphasizes flexibility and extensibility, and is suitable for various development scenarios.


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

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

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

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

WebStorm Mac version
Useful JavaScript development tools
