From c98a9d7051770b0bb10a52caf48e34194c8753ea Mon Sep 17 00:00:00 2001 From: Lodinu Kalugalage Date: Fri, 7 Jul 2023 04:00:34 +0800 Subject: [PATCH] Add console output codepage for windows (#967) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously unicode codepoints would be incorrectly shown in windows terminals, such as with u2503(┃): ```ps ❯ "print('\u{2503}')" | luau.exe Γöâ ``` This change fixes the issue by setting the console's codepage on windows, resulting in fixed behaviour: ```ps ❯ "print('\u{2503}')" | luau.exe ┃ ``` --- CLI/Repl.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CLI/Repl.cpp b/CLI/Repl.cpp index 87ce2717..df1b4eda 100644 --- a/CLI/Repl.cpp +++ b/CLI/Repl.cpp @@ -675,6 +675,10 @@ int replMain(int argc, char** argv) setLuauFlagsDefault(); +#ifdef _WIN32 + SetConsoleOutputCP(CP_UTF8); +#endif + int profile = 0; bool coverage = false; bool interactive = false;