From 16ba9e964cef0bd034136e792141d2c85000e4f7 Mon Sep 17 00:00:00 2001 From: Jeroen van Rijn Date: Wed, 2 Sep 2026 15:25:40 +0200 Subject: [PATCH] Apply mojibake magic to test runner, too. --- core/testing/runner.odin | 4 ++++ core/testing/terminal_window.odin | 16 ++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 core/testing/terminal_window.odin diff --git a/core/testing/runner.odin b/core/testing/runner.odin index e298cf47c..535dcc0b1 100644 --- a/core/testing/runner.odin +++ b/core/testing/runner.odin @@ -267,6 +267,10 @@ runner :: proc(internal_tests: []Internal_Test) -> bool { } } + when ODIN_OS == .Windows { + set_utf8_codepage() + defer restore_old_codepage() + } // `-vet` needs parameters to be shadowed by themselves first as an // explicit declaration, to allow the next line to work. diff --git a/core/testing/terminal_window.odin b/core/testing/terminal_window.odin new file mode 100644 index 000000000..b80f452f1 --- /dev/null +++ b/core/testing/terminal_window.odin @@ -0,0 +1,16 @@ +#+private +#+build windows +package testing + +import win32 "core:sys/windows" + +old_console_codepage: win32.CODEPAGE + +set_utf8_codepage :: proc() { + old_console_codepage = win32.GetConsoleOutputCP() + win32.SetConsoleOutputCP(win32.CODEPAGE(65001)) +} + +restore_old_codepage :: proc() { + win32.SetConsoleOutputCP(old_console_codepage) +} \ No newline at end of file