From: Takashi Yano <takashi.yano@nifty.ne.jp>
To: cygwin-patches@cygwin.com
Subject: [PATCH v3 2/2] Cygwin: pty: Fix input charset for non-cygwin apps with disable_pcon.
Date: Thu, 10 Sep 2020 00:28:00 +0900 [thread overview]
Message-ID: <20200909152800.791-3-takashi.yano@nifty.ne.jp> (raw)
In-Reply-To: <20200909152800.791-1-takashi.yano@nifty.ne.jp>
- 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 | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc
index 0bfc32ea9..1b021661f 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)
{
--
2.28.0
next prev parent reply other threads:[~2020-09-09 15:28 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-09 15:27 [PATCH v3 0/2] Cygwin: pty: Changes regarding charset conversion Takashi Yano
2020-09-09 15:27 ` [PATCH v3 1/2] Cygwin: pty: Revise convert_mb_str() function Takashi Yano
2020-09-09 15:28 ` Takashi Yano [this message]
2020-09-09 21:46 ` [PATCH v3 0/2] Cygwin: pty: Changes regarding charset conversion Corinna Vinschen
2020-09-10 0:00 ` Takashi Yano
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=20200909152800.791-3-takashi.yano@nifty.ne.jp \
--to=takashi.yano@nifty.ne.jp \
--cc=cygwin-patches@cygwin.com \
/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: link
Be 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).