[PATCH] Cygwin: pty: Fix input charset for non-cygwin apps with disable_pcon.
Takashi Yano
takashi.yano@nifty.ne.jp
Tue Sep 8 09:57:56 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 | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc
index 6de591d9b..afaa4546e 100644
--- a/winsup/cygwin/fhandler_tty.cc
+++ b/winsup/cygwin/fhandler_tty.cc
@@ -271,8 +271,17 @@ fhandler_pty_master::accept_input ()
bytes_left = eat_readahead (-1);
HANDLE write_to = get_output_handle ();
+ char *buf = NULL;
if (to_be_read_from_pcon ())
- write_to = to_slave;
+ {
+ write_to = to_slave;
+ size_t nlen;
+ buf = convert_mb_str (GetConsoleCP (), &nlen,
+ get_ttyp ()->term_code_page,
+ (const char *) p, bytes_left);
+ p = buf;
+ bytes_left = nlen;
+ }
if (!bytes_left)
{
@@ -305,6 +314,8 @@ fhandler_pty_master::accept_input ()
}
}
}
+ if (buf)
+ mb_str_free (buf);
SetEvent (input_available_event);
ReleaseMutex (input_mutex);
--
2.28.0
More information about the Cygwin-patches
mailing list