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