Fix problem with UTF-8 output when switching the code page under windows fails.

This commit is contained in:
Kugel Fuhr
2025-07-08 07:31:24 +02:00
parent c466faf484
commit 8d7c87f753

View File

@@ -127,8 +127,9 @@ void CP_Init (void)
#ifdef _WIN32 #ifdef _WIN32
if (IsTTY) { if (IsTTY) {
CodePage = GetConsoleOutputCP (); CodePage = GetConsoleOutputCP ();
if (SetConsoleOutputCP (CP_UTF8)) { IsUTF8 = (int) SetConsoleOutputCP (CP_UTF8);
IsUTF8 = 1; if (IsUTF8) {
/* Switch the code page back on exit */
atexit (Cleanup); atexit (Cleanup);
} }
if (Color) { if (Color) {