I got garbled warning text when building cpp source. How can I fix this issue ? Seems there is no way to execute "chcp 65001" for this terminal, which is triggered by "build task" garbled text in cl output
1 Answers
I encountered the same problem and the only working solution was to set the system local to UTF-8 (Using UTF-8 Encoding)
Edit: VS Code uses UTF-8 (chcp 65001) as default encoding. But if needed, you can execute chcp "65001" for the terminal by editing the build task. You need to use chcp as command and move 65001 and the path to the args.
"command": "chcp",
"args":[
"65001",
"&&",
"path/cl.exe",
...
]
The syntax of the documentation didn't work for me. I also found two issues (first, second) on GitHub for this problem.
You can also check the current Codepage/Encoding of the Terminal by using chcp without any args.
"command": "chcp",
"args":[
"&&",
"path/cl.exe",
...
]
I use g++.exe (mingw-w64) to compile cpp and the only option was to set the system local to UTF-8 hence the terminal already uses UTF-8, but the compiler output uses a different encoding (depending on your system settings).

- 101
- 2