1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-12-22 17:49:43 +01:00

Allow UTF-8 console output on Windows (for -console)

Right now, Windows assumes all our console output is code page ????.
That means our UTF-8 output appears mangled. (I ran into this while
testing IME text input by outputting strings to the console)

For a moment I was scared we'd need to do UTF-16 conversions and call
Windows-specific print functions like WriteConsoleW() in our vlog
functions, but fortunately SetConsoleOutputCP(CP_UTF8) works just fine.
This commit is contained in:
Dav999 2023-10-25 16:55:15 +02:00 committed by Misa Elizabeth Kai
parent 36dbb0f73a
commit 98d1a38d7f

View file

@ -220,6 +220,11 @@ void vlog_open_console(void)
}
check_color_support();
if (!SetConsoleOutputCP(CP_UTF8))
{
vlog_warn("Could not set code page for console output to UTF-8.");
}
}
#endif /* _WIN32 */