From 16abdd52546eb3cfa9d51d674c41711c2c170029 Mon Sep 17 00:00:00 2001 From: glx22 Date: Fri, 16 Jul 2021 18:12:17 +0200 Subject: Change: [Win32] Set the console codepage to UTF-8 --- src/debug.cpp | 6 ------ src/os/windows/win32.cpp | 3 +++ 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/debug.cpp b/src/debug.cpp index 418598d5d..2ac1dcc69 100644 --- a/src/debug.cpp +++ b/src/debug.cpp @@ -128,13 +128,7 @@ void DebugPrint(const char *level, const std::string &message) #endif } else { std::string msg = fmt::format("{}dbg: [{}] {}\n", GetLogPrefix(), level, message); -#if defined(_WIN32) - wchar_t system_buf[512]; - convert_to_fs(msg.c_str(), system_buf, lengthof(system_buf)); - fputws(system_buf, stderr); -#else fputs(msg.c_str(), stderr); -#endif NetworkAdminConsole(level, message); if (_settings_client.gui.developer >= 2) IConsolePrint(CC_DEBUG, "dbg: [{}] {}", level, message); diff --git a/src/os/windows/win32.cpp b/src/os/windows/win32.cpp index 938aee5f9..6b612ac40 100644 --- a/src/os/windows/win32.cpp +++ b/src/os/windows/win32.cpp @@ -393,6 +393,9 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi * be available between subsequent calls to FS2OTTD(). */ char *cmdline = stredup(FS2OTTD(GetCommandLine()).c_str()); + /* Set the console codepage to UTF-8. */ + SetConsoleOutputCP(CP_UTF8); + #if defined(_DEBUG) CreateConsole(); #endif -- cgit v1.2.3-70-g09d2