On 9/19/25 7:02 PM, 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.
        (mingw_utf8_str_to_utf16_str): 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 <[email protected]>
---
v3: Renamed utf16 to utf8 string conversion function to avoid name conflicts

NOTE: I could not reproduce the ones in question. Building gcc with LTO instead
gave me these problems:

Thanks, I have been paranoid of ODR/LTO clashes since I started it more often in my daily driver.

Bootstrap is good with linux amd64 native. I will push soon if there are no more comments.

Reply via email to