visual-studio-code - Why does debugging with lldb in VSCode garble chinese characters?
问题描述
I dabbled with Rust today and when I tried to print text with chinese characters using println!
it renders weird characters to the VSCode debug terminal.
I thought the problem would go away after installing language pack, but no such luck. Perhaps additional configuration is needed. It seems a quirk from the VSCode side; I ran cargo run
from a normal powershell terminal and it works fine.
main.rs
fn main() -> Result<(), Box<dyn Error>> {
println!("Test : {}", "阿拉有一只猫。");
Ok(())
}
launch.json
{
"version": "0.2.0",
"configurations": [
{
"type": "lldb",
"request": "launch",
"name": "Debug",
"cargo": {
"args": [
"build",
"--bin=test-app",
"--package=test-app"
],
"filter": {
"name": "test-app",
"kind": "bin"
}
},
"args": [],
"cwd": "${workspaceFolder}"
},
{
"type": "lldb",
"request": "launch",
"name": "Debug unit tests",
"cargo": {
"args": [
"test",
"--no-run",
"--bin=test-app",
"--package=test-app"
],
"filter": {
"name": "test-app",
"kind": "bin"
}
},
"args": [],
"cwd": "${workspaceFolder}"
}
]
}
解决方案
正如@kmdreko指出的那样,该错误存在 github 问题。
Beta: Use Unicode UTF-8 for worldwide language support
我尝试了在区域设置中启用选项的错误中提到的解决方法
,问题就消失了。
当然,这不是最好的解决方案。
如果您不想为该设置翻遍整个控制面板:
- 跑
control.exe international
Administrative
标签Change system locale
按钮
推荐阅读
- java - 使用 Java 只有一个对象可用时将 XML 转换为 JSON 数组
- django - 允许用户删除但保留对他们的引用
- linux - Ubuntu 上的 Docker 无法连接到 localhost 但可以连接到它的 ip
- c# - 你调用的对象是空的?(异常错误~ASP.NET MVC)
- javascript - 代码在本地主机上运行良好,但在托管主机提供商上运行良好 - 在互联网上搜索了 3 天,到目前为止许多尝试都是徒劳的
- c# - 在 EventHandler 中调用 this.StateHasChanged
- php - MySQL 更新查询使用等于 (=) 和 LIKE 与字母数字标准值
- c# - 如何从文件中获取缩略图
- javascript - 如何使用 reactJS 根据下拉选择更改表单字段
- tensorflow - tf.distribute.experimental.MultiWorkerMirroredStrategy() 无法正常工作