Home  >  Article  >  Development Tools  >  How to solve vscode terminal garbled characters

How to solve vscode terminal garbled characters

尚
Original
2020-03-26 17:36:214561browse

How to solve vscode terminal garbled characters

VS Code默认文件编码为 UTF-8,生成的可执行文件也是UTF-8编码的,但是系统编码为 GB2312,所以程序中的中文在显示的时候出现了问题

解决:利用 gcc 编译选项修改可执行文件的编码格式:-fexec-charset=utf-8;

  "code-runner.executorMap": {
        "c": "clear && cd $dir && gcc -fexec-charset=gbk $fileName -o .\\out\\$fileNameWithoutExt && .\\out\\$fileNameWithoutExt",
    }

查看系统编码:dos 下输入 chcp,得到代码页信息,https://blog.csdn.net/zp357252539/article/details/79084480

推荐学习:vscode教程

The above is the detailed content of How to solve vscode terminal garbled characters. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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