4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-02-02 12:30:24 +08:00

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.
This commit is contained in:
Takashi Yano via Cygwin-patches 2020-09-10 00:28:00 +09:00 committed by Ken Brown
parent 4bb14b2ee5
commit e79d9d5b59

View File

@ -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;
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)
{