From 8d7c87f753aee16fa370ab3d7e34cff72aefc757 Mon Sep 17 00:00:00 2001 From: Kugel Fuhr <98353208+kugelfuhr@users.noreply.github.com> Date: Tue, 8 Jul 2025 07:31:24 +0200 Subject: [PATCH] Fix problem with UTF-8 output when switching the code page under windows fails. --- src/common/consprop.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/common/consprop.c b/src/common/consprop.c index 03ecb449d..9dceef1b3 100644 --- a/src/common/consprop.c +++ b/src/common/consprop.c @@ -127,8 +127,9 @@ void CP_Init (void) #ifdef _WIN32 if (IsTTY) { CodePage = GetConsoleOutputCP (); - if (SetConsoleOutputCP (CP_UTF8)) { - IsUTF8 = 1; + IsUTF8 = (int) SetConsoleOutputCP (CP_UTF8); + if (IsUTF8) { + /* Switch the code page back on exit */ atexit (Cleanup); } if (Color) {