]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
gdb: Support UTF-8 output on MS-Windows terminal
authorEli Zaretskii <eliz@gnu.org>
Thu, 22 Jan 2026 11:03:13 +0000 (13:03 +0200)
committerEli Zaretskii <eliz@gnu.org>
Thu, 22 Jan 2026 11:03:13 +0000 (13:03 +0200)
commit43c658ff0cf2bf0b407a563b0de2a36d55e2d5df
tree3e137edcd3fa93e3aa82b3e1a4426fa6a4b8da45
parent0a4433b3c9ddb1fd6b606e763624cc759af19811
gdb: Support UTF-8 output on MS-Windows terminal

This detects when the Windows Terminal uses codepage 65001
(a.k.a. "UTF-8") for output, and sets the default host
charset to UTF-8 in that case.  It also enables Emoji
styling, as the Windows terminal supports it in that case.

* gdb/charset.c (INIT_GDB_FILE) [USE_WIN32API]: If the Windows
console uses codepage 65001, set default host charset to UTF-8, and
switch to the "C" locale, to prevent Windows from interpreting UTF-8
sequences written to the console.
* gdb/mingw-hdep.c (windows_initialize_console): Don't disable Emoji
here...
* gdb/charset.c (INIT_GDB_FILE) [USE_WIN32API]: ...disable them here
instead, and only if the console doesn't use UTF-8.
gdb/charset.c
gdb/charset.h
gdb/mingw-hdep.c