Skip to content

Commit cb137d9

Browse files
authored
Remove setlocale call in __hxcpp_stdlibs_boot (#1284)
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.
1 parent 0b59d98 commit cb137d9

File tree

1 file changed

+0
-2
lines changed

1 file changed

+0
-2
lines changed

src/hx/StdLibs.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,8 +283,6 @@ void __hxcpp_stdlibs_boot()
283283
//_setmode(_fileno(stdin), 0x00040000); // _O_U8TEXT
284284
#endif
285285

286-
// This is necessary for UTF-8 output to work correctly.
287-
setlocale(LC_ALL, "");
288286
setlocale(LC_NUMERIC, "C");
289287

290288
// I think this does more harm than good.

0 commit comments

Comments
 (0)