FIXME: On Windows 7, UTF-8 console output can randomly crash the program.
Some checks failed
Codecov / run (push) Has been cancelled
CodeQL / Analyze (cpp) (push) Has been cancelled

Not sure why. It's probably a limitation of the older console.

It works on Windows 10. (tested on 1809)

TODO: Does it work on Windows 8 or 8.1?
This commit is contained in:
David Korth 2025-04-21 23:36:12 -04:00
parent 602165f822
commit 18d005bb2b
2 changed files with 10 additions and 2 deletions

View File

@ -190,7 +190,11 @@ int RP_C_API _tmain(int argc, TCHAR *argv[])
// Enable UTF-8 console output.
// Tested on Windows XP (fails) and Windows 7 (works).
// TODO: Does it work on Windows Vista?
if (IsWindowsVistaOrGreater()) {
// FIXME: On Windows 7, if locale is set to Spanish (es_ES), running
// `rpcli rpcli.exe` causes a random crash halfway through printing,
// if we set the console output CP to UTF-8.
// TODO: Verify if that happens on Windows 8 or 8.1.
if (IsWindows10OrGreater()) {
old_console_output_cp = GetConsoleOutputCP();
atexit(RestoreConsoleOutputCP);
SetConsoleOutputCP(CP_UTF8);

View File

@ -658,7 +658,11 @@ int RP_C_API _tmain(int argc, TCHAR *argv[])
// Enable UTF-8 console output.
// Tested on Windows XP (fails) and Windows 7 (works).
// TODO: Does it work on Windows Vista?
if (IsWindowsVistaOrGreater()) {
// FIXME: On Windows 7, if locale is set to Spanish (es_ES), running
// `rpcli rpcli.exe` causes a random crash halfway through printing,
// if we set the console output CP to UTF-8.
// TODO: Verify if that happens on Windows 8 or 8.1.
if (IsWindows10OrGreater()) {
old_console_output_cp = GetConsoleOutputCP();
atexit(RestoreConsoleOutputCP);
SetConsoleOutputCP(CP_UTF8);