windows: more setlocale
This commit is contained in:
@@ -1911,16 +1911,18 @@ tty_utf8graphics_fixup(void)
|
||||
{
|
||||
CONSOLE_FONT_INFOEX console_font_info;
|
||||
if ((tty_procs.wincap2 & WC2_U_UTF8STR) && SYMHANDLING(H_UTF8)) {
|
||||
char *tmpstr = 0;
|
||||
char *localestr = 0;
|
||||
|
||||
if (!console.hConOut)
|
||||
if (!console.hConOut)
|
||||
console.hConOut = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
/* the locale */
|
||||
if (console.localestr)
|
||||
if (console.localestr) {
|
||||
free(console.localestr);
|
||||
tmpstr = setlocale(LC_ALL, ".UTF8");
|
||||
if (tmpstr)
|
||||
console.localestr = dupstr(tmpstr);
|
||||
console.localestr = NULL;
|
||||
}
|
||||
localestr = setlocale(LC_ALL, ".UTF8");
|
||||
if (localestr)
|
||||
console.localestr = dupstr(localestr);
|
||||
/* the code page */
|
||||
SetConsoleOutputCP(65001);
|
||||
console.code_page = GetConsoleOutputCP();
|
||||
@@ -2510,7 +2512,10 @@ void nethack_enter_consoletty(void)
|
||||
console.orig_code_page = GetConsoleOutputCP();
|
||||
|
||||
/* store the original locale */
|
||||
console.orig_localestr = dupstr(setlocale(LC_ALL, ""));
|
||||
console.orig_localestr = NULL;
|
||||
localestr = setlocale(LC_ALL, "");
|
||||
if (localestr)
|
||||
console.orig_localestr = dupstr(localestr);
|
||||
|
||||
/* store the original font */
|
||||
console.orig_font_info.cbSize = sizeof(console.orig_font_info);
|
||||
|
||||
Reference in New Issue
Block a user