VSCode 调试器遇到字符编码问题 [英] VSCode debugger having issues with character encoding

查看:36
本文介绍了VSCode 调试器遇到字符编码问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个问题在这里之前被问到 但是这个问题没有答案.

This question was asked before here but there is no answers on this questions.

当尝试调试 charstring 类型时,调试器打印 Converting character sets:无效的参数 分别代替它的值.

When trying to debug char or string type, the debugger prints <error reading variable> or Converting character sets: Invalid argument respectively instead of its value.

这个问题可以通过在调试时从调试控制台运行 -exec set charset UTF-8 来修复,但这只是一个临时修复,并且必须在每次调试器启动时手动运行.

This problem can be fixed by running -exec set charset UTF-8 from the debug console while debugging but it is only a temporary fix, and has to be run every time on debugger startup manually.

有没有办法永久解决这个问题?(我不想更改任何系统设置)

Is there a way to permanently fix this issue? (I'd prefer not to change any system settings)

推荐答案

Launch.json 文件中,将 set charset UTF-8 添加到 setupCommands 修复它.

In the Launch.json file, adding set charset UTF-8 to the setupCommands fixed it.

"setupCommands": [
    {
        "description": "Enable pretty-printing for gdb",
        "text": "-enable-pretty-printing",
        "ignoreFailures": true
    },
    {
        "text": "set charset UTF-8"
    }
]

这篇关于VSCode 调试器遇到字符编码问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆