diff options
author | Takashi Yano <takashi.yano@nifty.ne.jp> | 2020-01-10 20:47:12 +0900 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2020-01-14 17:19:49 +0100 |
commit | 50e2a63b04bdd018484605fbb954fd1bd5147fa0 (patch) | |
tree | 260718d77b6cdd81a00bf9363c7b2dbaaed06fb2 | |
parent | 2f415d5efae5a47906f0fdf5080c407b56b5ce20 (diff) | |
download | cygnal-50e2a63b04bdd018484605fbb954fd1bd5147fa0.tar.gz cygnal-50e2a63b04bdd018484605fbb954fd1bd5147fa0.tar.bz2 cygnal-50e2a63b04bdd018484605fbb954fd1bd5147fa0.zip |
Cygwin: pty: Set console code page only if pseudo console is enabled.
- Input UTF-8 chars are garbled in ConEmu with cygwin connector if
the environment does not support pseudo console. This patch fixes
the issue.
-rw-r--r-- | winsup/cygwin/fhandler_tty.cc | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc index 983e058dc..fff5bebe3 100644 --- a/winsup/cygwin/fhandler_tty.cc +++ b/winsup/cygwin/fhandler_tty.cc @@ -2626,15 +2626,18 @@ fhandler_pty_slave::setup_locale (void) LCID lcid = get_langinfo (locale, charset); /* Set console code page form locale */ - UINT code_page; - if (lcid == 0 || lcid == (LCID) -1) - code_page = 20127; /* ASCII */ - else if (!GetLocaleInfo (lcid, - LOCALE_IDEFAULTCODEPAGE | LOCALE_RETURN_NUMBER, - (char *) &code_page, sizeof (code_page))) - code_page = 20127; /* ASCII */ - SetConsoleCP (code_page); - SetConsoleOutputCP (code_page); + if (get_pseudo_console ()) + { + UINT code_page; + if (lcid == 0 || lcid == (LCID) -1) + code_page = 20127; /* ASCII */ + else if (!GetLocaleInfo (lcid, + LOCALE_IDEFAULTCODEPAGE | LOCALE_RETURN_NUMBER, + (char *) &code_page, sizeof (code_page))) + code_page = 20127; /* ASCII */ + SetConsoleCP (code_page); + SetConsoleOutputCP (code_page); + } /* Set terminal code page from locale */ /* This code is borrowed from mintty: charset.c */ |