[PATCH 2/2] Cygwin: pty: Fix input charset for non-cygwin apps with disable_pcon.
Takashi Yano
takashi.yano@nifty.ne.jp
Wed Sep 9 08:07:21 GMT 2020
- If the non-cygwin apps is executed under pseudo console disabled,
multibyte input for the apps are garbled. This patch fixes the
issue.
---
winsup/cygwin/fhandler_tty.cc | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc
index e7485af72..7fa8c99e8 100644
--- a/winsup/cygwin/fhandler_tty.cc
+++ b/winsup/cygwin/fhandler_tty.cc
@@ -309,8 +309,18 @@ fhandler_pty_master::accept_input ()
bytes_left = eat_readahead (-1);
HANDLE write_to = get_output_handle ();
+ tmp_pathbuf tp;
+ char *mbbuf = tp.c_get ();
if (to_be_read_from_pcon ())
- write_to = to_slave;
+ {
+ write_to = to_slave;
+ static mbpend_t mbpend;
+ size_t nlen = NT_MAX_PATH;
+ convert_mb_str (GetConsoleCP (), mbbuf, &nlen,
+ get_ttyp ()->term_code_page, p, bytes_left, &mbpend);
+ p = mbbuf;
+ bytes_left = nlen;
+ }
if (!bytes_left)
{
--
2.28.0
More information about the Cygwin-patches
mailing list