Cygwin: pty: Revise the code for setting code page of pseudo console.
- Fix the problem which overrides the code page setting, reported in https://www.cygwin.com/ml/cygwin/2019-12/msg00292.html.
This commit is contained in:
parent
fd03749b9c
commit
b3e78186d1
|
@ -2629,14 +2629,12 @@ fhandler_pty_slave::setup_locale (void)
|
||||||
if (lcid == 0 || lcid == (LCID) -1)
|
if (lcid == 0 || lcid == (LCID) -1)
|
||||||
code_page = 20127; /* ASCII */
|
code_page = 20127; /* ASCII */
|
||||||
else if (!GetLocaleInfo (lcid,
|
else if (!GetLocaleInfo (lcid,
|
||||||
LOCALE_IDEFAULTANSICODEPAGE | LOCALE_RETURN_NUMBER,
|
LOCALE_IDEFAULTCODEPAGE | LOCALE_RETURN_NUMBER,
|
||||||
(char *) &code_page, sizeof (code_page)))
|
(char *) &code_page, sizeof (code_page)))
|
||||||
code_page = 20127; /* ASCII */
|
code_page = 20127; /* ASCII */
|
||||||
SetConsoleCP (code_page);
|
SetConsoleCP (code_page);
|
||||||
SetConsoleOutputCP (code_page);
|
SetConsoleOutputCP (code_page);
|
||||||
|
|
||||||
if (get_ttyp ()->term_code_page == 0)
|
|
||||||
{
|
|
||||||
/* Set terminal code page from locale */
|
/* Set terminal code page from locale */
|
||||||
/* This code is borrowed from mintty: charset.c */
|
/* This code is borrowed from mintty: charset.c */
|
||||||
get_ttyp ()->term_code_page = 20127; /* Default ASCII */
|
get_ttyp ()->term_code_page = 20127; /* Default ASCII */
|
||||||
|
@ -2662,7 +2660,6 @@ fhandler_pty_slave::setup_locale (void)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
fhandler_pty_slave::fixup_after_attach (bool native_maybe, int fd_set)
|
fhandler_pty_slave::fixup_after_attach (bool native_maybe, int fd_set)
|
||||||
|
@ -2792,6 +2789,7 @@ fhandler_pty_slave::fixup_after_exec ()
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set locale */
|
/* Set locale */
|
||||||
|
if (get_ttyp ()->term_code_page == 0)
|
||||||
setup_locale ();
|
setup_locale ();
|
||||||
|
|
||||||
#if USE_API_HOOK
|
#if USE_API_HOOK
|
||||||
|
|
|
@ -3,3 +3,6 @@ Bug Fixes
|
||||||
|
|
||||||
- Define CPU_SETSIZE, as on Linux.
|
- Define CPU_SETSIZE, as on Linux.
|
||||||
Addresses: https://cygwin.com/ml/cygwin/2019-12/msg00248.html
|
Addresses: https://cygwin.com/ml/cygwin/2019-12/msg00248.html
|
||||||
|
|
||||||
|
- Fix the problem which overrides the code page setting.
|
||||||
|
Addresses: https://www.cygwin.com/ml/cygwin/2019-12/msg00292.html
|
||||||
|
|
Loading…
Reference in New Issue