Unicode not showing properly in git-bash when debugging in Visual Studio Code.

huangapple go评论73阅读模式
英文:

Unicode not showing properly in git-bash when debugging in Visual Studio Code

问题

I tried debugging a cli app in rust. Running it with any profile for integrated terminal caused it to show incorrect characters for box drawings

它显示了"ÔöÇÔöÔÇöÇÔöÇ",而不是"────────────"。

Setting chcp.com 65001 as args for integrated terminal profile did fix it for cmd and PowerShell, couldn't get it to work for Git Bash

chcp.com 65001设置为集成终端配置文件的参数可解决cmd和PowerShell的问题,但无法解决Git Bash的问题

And when I tried opening it up in external terminal (using Windows Terminal) it always opened up with CMD even though I have a default profile set to Git Bash for both VS Code and Windows Terminal.

而当我尝试在外部终端中打开它(使用Windows终端)时,它总是以CMD打开,尽管我在VS Code和Windows终端中都设置了Git Bash作为默认配置文件。

Running the program itself manually in windows terminal works as expected.

在Windows终端中手动运行程序正常。

I tried to debug TUI application in VS Code and expected to show properly.

我尝试在VS Code中调试TUI应用程序,希望能正常显示。

英文:

I tried debugging a cli app in rust. Running it with any profile for integrated terminal caused it to show incorrect characters for box drawings

It showed "ÔöÇÔöÔÇöÇÔöÇ" instead of "────────────".

Setting chcp.com 65001 as args for integrated terminal profile did fix it for cmd and PowerShell, couldn't get it to work for Git Bash

And when I tried opening it up in external terminal (using Windows Terminal) it always opened up with CMD even though I have a default profile set to Git Bash for both VS Code and Windows Terminal.

Running the program itself manually in windows terminal works as expected.

I tried to debug TUI application in VS Code and expected to show properly.

答案1

得分: 1

感谢@Finomnis
在参数中我漏掉了额外的bash参数。
现在它似乎可以工作

完整对象:

"terminal.integrated.profiles.windows": {
    "PowerShell": {
        "source": "PowerShell",
        "icon": "terminal-powershell",
        "args": ["-NoExit", "/c", "chcp.com 65001"]
    },
    "Command Prompt": {
        "path": [
            "${env:windir}\\Sysnative\\cmd.exe",
            "${env:windir}\\System32\\cmd.exe"
        ],
        "args": ["-NoExit", "/c", "chcp.com 65001"],
        "icon": "terminal-cmd"
    },
    "Git Bash": {
        "source": "Git Bash",
        "env": {
            "LANG": "C.UTF-8"
        },
        "args": ["-c", "chcp.com 65001;bash"]
    }
}
英文:

Thanks to @Finomnis
I was missing the extra bash arg in the args.
Now it sort of works

Full object:

"terminal.integrated.profiles.windows": {
        "PowerShell": {
            "source": "PowerShell",
            "icon": "terminal-powershell",
            "args": ["-NoExit", "/c", "chcp.com 65001"]
        },
        "Command Prompt": {
            "path": [
                "${env:windir}\\Sysnative\\cmd.exe",
                "${env:windir}\\System32\\cmd.exe"
            ],
            "args": ["-NoExit", "/c", "chcp.com 65001"],
            "icon": "terminal-cmd"
        },
        "Git Bash": {
            "source": "Git Bash",
            "env": {
                "LANG": "C.UTF-8"
            },
            "args": ["-c","chcp.com 65001;bash"]

        }
    }

huangapple
  • 本文由 发表于 2023年4月4日 15:20:27
  • 转载请务必保留本文链接:https://go.coder-hub.com/75926539.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定