vadimcn / codelldb

A native debugger extension for VSCode based on LLDB
https://marketplace.visualstudio.com/items?itemName=vadimcn.vscode-lldb
MIT License
2.6k stars 246 forks source link

CodeLLDB Plugin Displays Garbled Characters in Terminal #1012

Open GrayArashiAI opened 1 year ago

GrayArashiAI commented 1 year ago

OS: Windows10 x64 VSCode version: 1.83.1 x64 CodeLLDB version: v1.10.0 Compiler: rustc 1.73.0 (cc66ad468 2023-10-03) Debuggee: x86_64-windows-msvc

Problem: When using the CodeLLDB plugin to debug Rust code, the characters in the terminal, such as Japanese and Chinese characters, are displayed as garbled text. My computer's environment is set to Shift-JIS, but I have configured VSCode with the default encoding as UTF-8. In a typical scenario, the CodeLLDB plugin should use the encoding specified in VSCode since it is an extension for VSCode, and the terminal runs within VSCode. However, it appears that CodeLLDB is not using the default encoding set in VSCode and is instead using the encoding from my Windows environment. This results in garbled text in the terminal.

Steps to Reproduce:

Set the system's encoding to Shift-JIS. Configure VSCode to use UTF-8 as the default encoding. Create or open a Rust project in VSCode with Japanese/Chinese Print out. Observe that the terminal displays garbled text for non-ASCII characters.

Example Code:

fn main() {
    println!("ハロー・ワールド!");
    println!("你好・世界!");
}

Expected Behavior: The CodeLLDB plugin should respect the default encoding set in VSCode and display characters correctly in the terminal. This is how it executed with rust-analyzer:

 *  実行するタスク: C:\Users\******\.cargo\bin\cargo.exe run --package example --bin example 

   Compiling example v0.1.0 (D:\Rust\example)
    Finished dev [unoptimized + debuginfo] target(s) in 2.33s
     Running `target\debug\example.exe`
ハロー・ワールド!
你好・世界!

Actual Behavior: CodeLLDB appears to use the system's encoding instead of the VSCode default encoding, resulting in garbled text in the terminal.

繝上Ο繝シ繝サ繝ッ繝シ繝ォ繝会シ・菴螂ス繝サ荳也阜・・
PS D:\Rust\example> 
tws135320 commented 4 months ago

I've encountered the same issue too. Is there a solution available now?

gzw13999 commented 4 months ago

I've encountered the same issue too. Is there a solution available now?

+1

vadimcn commented 1 month ago

I the garbled test outputted by the debuggee? In which case I am not sure this is related to codelldb - it asks vscode to create a terminal, then connects debuggee output to that terminal. It is not directly involved in outputting to the terminal after that.