From 8dbe496eb8a4e98430feb389a8997b8bb0bb17fc Mon Sep 17 00:00:00 2001 From: Tobiasz Laskowski Date: Thu, 25 Dec 2025 22:41:19 +0000 Subject: [PATCH] Remove setlocale call in __hxcpp_stdlibs_boot On Windows, this meant the utf-8 string passed to printf("%s") was interpreted as if it is from the default system locale encoding instead of utf-8, which are incompatible so any non-ASCII text comes out garbled. This setlocale call also meant that using `chcp 65001` does not haxe the correct effect of being able to view the full range of utf-8 characters from print output. Originally, this setlocale call was required required due to the use of print("%S"), but the printing functions in Stdlibs.cpp no longer rely on that so it is safe to remove. --- src/hx/StdLibs.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/hx/StdLibs.cpp b/src/hx/StdLibs.cpp index cd6a3ed5d..61fff40d7 100644 --- a/src/hx/StdLibs.cpp +++ b/src/hx/StdLibs.cpp @@ -283,8 +283,6 @@ void __hxcpp_stdlibs_boot() //_setmode(_fileno(stdin), 0x00040000); // _O_U8TEXT #endif - // This is necessary for UTF-8 output to work correctly. - setlocale(LC_ALL, ""); setlocale(LC_NUMERIC, "C"); // I think this does more harm than good.