public inbox for cygwin-cvs@sourceware.org help / color / mirror / Atom feed
From: Corinna Vinschen <corinna@sourceware.org> To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin] Cygwin: pty: Fix input charset for non-cygwin apps with disable_pcon. Date: Wed, 9 Sep 2020 21:44:49 +0000 (GMT) [thread overview] Message-ID: <20200909214449.20F84385041C@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=fd3ad92f9ee1e6f58ffe3597fbd5bba3c778677d commit fd3ad92f9ee1e6f58ffe3597fbd5bba3c778677d Author: Takashi Yano via Cygwin-patches <cygwin-patches@cygwin.com> Date: Thu Sep 10 00:28:00 2020 +0900 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. Diff: --- winsup/cygwin/fhandler_tty.cc | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) 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) {
reply other threads:[~2020-09-09 21:44 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20200909214449.20F84385041C@sourceware.org \ --to=corinna@sourceware.org \ --cc=cygwin-cvs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).