diff options
author | Takashi Yano via Cygwin-patches <cygwin-patches@cygwin.com> | 2020-09-10 00:28:00 +0900 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2020-09-09 21:35:46 +0200 |
commit | fd3ad92f9ee1e6f58ffe3597fbd5bba3c778677d (patch) | |
tree | 73d90f8bddd7aeafadb26ebf06a1bf70eb905f40 | |
parent | 91908fe00096d0979dd021599865a1ad02179078 (diff) | |
download | cygnal-fd3ad92f9ee1e6f58ffe3597fbd5bba3c778677d.tar.gz cygnal-fd3ad92f9ee1e6f58ffe3597fbd5bba3c778677d.tar.bz2 cygnal-fd3ad92f9ee1e6f58ffe3597fbd5bba3c778677d.zip |
Cygwin: pty: Fix input charset for non-cygwin apps with disable_pcon.
- If the non-cygwin apps is executed under pseudo console disabled,
multibyte input for the apps are garbled. This patch fixes the
issue.
-rw-r--r-- | winsup/cygwin/fhandler_tty.cc | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc index 0bfc32ea9..16d4a99f4 100644 --- a/winsup/cygwin/fhandler_tty.cc +++ b/winsup/cygwin/fhandler_tty.cc @@ -295,8 +295,22 @@ fhandler_pty_master::accept_input () bytes_left = eat_readahead (-1); HANDLE write_to = get_output_handle (); + tmp_pathbuf tp; if (to_be_read_from_pcon ()) - write_to = to_slave; + { + write_to = to_slave; + UINT cp_to = GetConsoleCP (); + if (get_ttyp ()->term_code_page != cp_to) + { + static mbstate_t mbp; + char *mbbuf = tp.c_get (); + size_t nlen = NT_MAX_PATH; + convert_mb_str (cp_to, mbbuf, &nlen, + get_ttyp ()->term_code_page, p, bytes_left, &mbp); + p = mbbuf; + bytes_left = nlen; + } + } if (!bytes_left) { |