On 9/10/25 3:29 AM, Peter Damianov wrote:
UTF-8 characters in diagnostic output (such as the warning emoji ⚠️
used by fanalyzer) display as mojibake on Windows unless the utf8
code page is being used
This patch adds UTF-8 to UTF-16 conversion when outputting to a console
on Windows.
gcc/ChangeLog:
* pretty-print.cc (decode_utf8_char): Move forward declaration.
(utf8_to_utf16): New function to convert UTF-8 to UTF-16.
(is_console_handle): New function to detect Windows console handles.
(write_all): Add UTF-8 to UTF-16 conversion for console output,
falling back to WriteFile for ASCII strings and regular files.
Signed-off-by: Peter Damianov <peter0...@disroot.org>
This resulted in build failures for Linux native gcc, you may need to
reorganize the ifdefs:
error: ‘decode_utf8_char’ was not declared in this scope
From around line 2835:
const int valid_utf8_len = decode_utf8_char (ups, n, &extended_char);
Please also restore the formfeed character.
Thanks.