microsoft / microsoft/vscode-cpptools

debugger cannot show chinese characters from a string variable

Aperta
#5,712 5 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

debugger Feature Request
Lingua principale
TypeScript
Stelle
6.2k
Fork
1.7k
Merge medio
14h 46m
PR unite (30g)
61

Descrizione

#include <bits/stdc++.h>

using namespace std;

string replace(string line, string o, string n) {
    auto i = line.find(o);
    if (i != string::npos) {
        return line.replace(i, o.length(), n);
    }
    return line;
}

int main() {
    string line;
    cout << "> ";
    while (getline(cin, line)) {
        line = replace(line, "你", "我");
        line = replace(line, "吗", "");
        line = replace(line, "?", "");
        line = replace(line, "?", "");
        cout << line << endl;
        cout << "> ";
    }
}

I try to debug these code above and input "你好吗" to line but the debugger cannot show its content properly.

It seem a matter of gdb problem, if so, what can I do to fix it?

my config is as follow

{
      "name": "desktop debug",
      "type": "cppdbg",
      "request": "launch",
      "program": "${fileDirname}\\${fileBasenameNoExtension}.exe",
      "args": [],
      "stopAtEntry": true,
      "cwd": "${workspaceFolder}",
      "environment": [],
      "externalConsole": true,
      "MIMode": "gdb",
      "miDebuggerPath": "C:\\sdk\\mingw64\\mingw64\\bin\\gdb.exe",
      "setupCommands": [
        {
          "description": "为 gdb 启用整齐打印",
          "text": "-enable-pretty-printing",
          "ignoreFailures": false
        }
      ],
      "preLaunchTask": "g++.exe build active file"
}
➜ g++ --version
g++.exe (x86_64-posix-seh-rev0, Built by MinGW-W64 project) 8.1.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

➜ gdb --version
GNU gdb (GDB) 8.1
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"   
and "show warranty" for details.
This GDB was configured as "x86_64-w64-mingw32".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".

plugin version

0.29.0-insiders

os version

20H2 (os  内部版本 19042.330)

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Riproduci il problema in VS Code usando il programma C++ fornito, la configurazione di avvio, MinGW GDB 8.1 e l’ambiente Windows. Inizia verificando come l’estensione C++ visualizza la variabile line nel debugger, quindi confronta il valore visualizzato con l’input in cinese. Il lavoro è completato quando i caratteri cinesi della stringa vengono visualizzati correttamente durante il debug.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
cpp, vscode
Ambito
devtools
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.