From 95e89e9156ed9a1fb16233bfe6c7a0efc1e4e191 Mon Sep 17 00:00:00 2001 From: Kelly Kinkade Date: Sat, 4 Apr 2026 12:21:20 -0500 Subject: [PATCH] use utf8 in windows console been wanting to do this for a very long time ref #1474 --- docs/changelog.txt | 1 + library/Console-windows.cpp | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/docs/changelog.txt b/docs/changelog.txt index bf2ca7d998..36aba6f46e 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -33,6 +33,7 @@ Template for new versions: ## New Features ## Fixes +- Core: Windows console will always use UTF-8 regardless of system code page settings ## Misc Improvements diff --git a/library/Console-windows.cpp b/library/Console-windows.cpp index 12a3e0c2eb..058cedebe0 100644 --- a/library/Console-windows.cpp +++ b/library/Console-windows.cpp @@ -474,6 +474,10 @@ bool Console::init(bool) HMENU hm = GetSystemMenu(d->ConsoleWindow,false); DeleteMenu(hm, SC_CLOSE, MF_BYCOMMAND); + // force console code pages to utf-8 + SetConsoleCP(CP_UTF8); + SetConsoleOutputCP(CP_UTF8); + // set the screen buffer to be big enough to let us scroll text GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &coninfo); d->default_attributes = coninfo.wAttributes;