Skip to content

Commit 7a61905

Browse files
committed
Fix Windows UTF-8 support.
1 parent 514f7ba commit 7a61905

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/doomgeneric_ascii.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,8 +264,14 @@ void DG_Init(void)
264264
if (i > 0)
265265
keypress_smoothing_ms = atoi(myargv[i + 1]);
266266

267-
if (character_set != ASCII && !setlocale(LC_ALL, "en_US.UTF-8"))
268-
I_Error("DG_Init: setlocale error");
267+
if (character_set != ASCII) {
268+
#ifdef OS_WINDOWS
269+
WINDOWS_CALL(!SetConsoleOutputCP(CP_UTF8), "DG_Init: %s");
270+
#else
271+
if (!setlocale(LC_ALL, "en_US.UTF-8"))
272+
I_Error("DG_Init: setlocale error");
273+
#endif
274+
}
269275

270276
/* Longest per-pixel SGR code: \033[38;2;RRR;GGG;BBBm (length 19)
271277
* 2 Chars per pixel

0 commit comments

Comments
 (0)