* [PATCH 2/3] fhandler_pty_slave::setup_locale: fall back to UTF-8, not ASCII
@ 2020-09-01 16:18 Johannes Schindelin
0 siblings, 0 replies; only message in thread
From: Johannes Schindelin @ 2020-09-01 16:18 UTC (permalink / raw)
To: cygwin-patches
When we fail to determine the Console output code page to use in the
Pseudo Console, we used to fall back to ASCII.
However, a much better fall-back code page is UTF-8 because that's what
Cygwin defaults to, internally, when no encoding was specified.
Besides, `/etc/profile.d/lang.sh` essentially sets `LANG=$(locale -uU)`
(where the `-U` says that `.UTF-8` should be appended). Meaning: we
_really_ want to use the UTF-8 code page.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
winsup/cygwin/fhandler_tty.cc | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc
index b3458595a..06789a500 100644
--- a/winsup/cygwin/fhandler_tty.cc
+++ b/winsup/cygwin/fhandler_tty.cc
@@ -2864,11 +2864,11 @@ fhandler_pty_slave::setup_locale (void)
{
UINT code_page;
if (lcid == 0 || lcid == (LCID) -1)
- code_page = 20127; /* ASCII */
+ code_page = CP_UTF8; /* Cygwin prefers UTF-8 */
else if (!GetLocaleInfo (lcid,
LOCALE_IDEFAULTCODEPAGE | LOCALE_RETURN_NUMBER,
(char *) &code_page, sizeof (code_page)))
- code_page = 20127; /* ASCII */
+ code_page = CP_UTF8; /* Cygwin prefers UTF-8 */
SetConsoleCP (code_page);
SetConsoleOutputCP (code_page);
}
--
2.27.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-09-01 19:50 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-01 16:18 [PATCH 2/3] fhandler_pty_slave::setup_locale: fall back to UTF-8, not ASCII Johannes Schindelin
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).