Open georgetian3 opened 3 years ago
Does the machine that are not displaying the characters have python
installed? GDB visualizers are dependent on python
.
Python 3.9.0 is installed and is in PATH.
Hi. I have the same problem with python 3.8 in PATH. Is there a workaround?
I found a workaround in this chinese blog https://blog.csdn.net/m0_46304383/article/details/113487503 (translated with google transator). It seems a Windows 10 UTF-8 problem. I hope it can also help you @georgetian3.
The workaround is: "Windows Settings" -> "Time and Language" -> "Region" -> "Other Date -> Time and Regional Settings" -> "Change Date -> Time or Number Format" -> "Manage" -> "Change System Regional Settings" -> Uncheck "Beta version: Use Unicode UTF-8 to provide global language support" -> restart the computer
That seems to have been the issue, problem solved, thank you!
Hi @georgetian3 I happy that worked for you. 👍 But, for me, the solution is only a work around. May the @WardenGnaw and cpptools team may evaluate if it is a bug that requeres be fixed.
That's true, I'll reopen and hope they'll be able to have a look.
I had the same issue and this stackoverflow answer solved the problem perfectly
Summary of the solutions:
I find (2) to be better. Create a .gdbinit
with set charset UTF-8
and things start working. I don't use VSCode but plain GDB on MSYS2 but found this issue discussion useful. Thanks!
Summary of the solutions:
- Turn off Unicode UTF-8 on Windows
- Enable UTF-8 on GDB
I find (2) to be better. Create a
.gdbinit
withset charset UTF-8
and things start working. I don't use VSCode but plain GDB on MSYS2 but found this issue discussion useful. Thanks!
Thanks for your awesome answer! If combining 1 (turn on) and 2 (enable) together, the result is amazing! (fixed 2 bugs simultaneously)
FTR, one additional glitch I've found with GDB: if you have set new-console
in its config (which is kinda the only sane way to use it with stuff printing lots of diag. messages to stderr), then despite set charset UTF-8
and despite setting up the local terminal code page with chcp 65001
, the opened new terminal window will have the wrong idea about the code page (and conversions). If you disable set new-console
(opening new terminals for executables), and just use the same terminal GDB is using, it's fine. (It looks like GDB doesn't initialize the new console properly, forgetting about replicating the code page (conversion) of the original.)
When debugging a C++ file containing character arrays or strings, the contents of the array/string are not shown, but instead shows "\<error reading variable>" for character arrays and "Converting character sets: Invalid argument." for strings. Integer arrays are not affected:
However, what puzzles me is that on a different machine but with the exact same VSCode version (1.52.1), C/C++ extension version (v1.1.3) and C++ compiler (mingw-w64 x86_64-8.1.0-posix-seh-rt_v6-rev0), and
launch.json
file, the contents of the array/string appears normally:The contents of
launch.json
are given below:This problem has been posted elsewhere but with no solutions, as seen here and here
Steps to Reproduce:
The issue still persists after disabling all extensions apart from the C/C++ tools extension.