[newlib-cygwin] Fix regression in console charset handling

Corinna Vinschen corinna@sourceware.org
Wed Oct 19 10:54:00 GMT 2016


commit 5a3496c3e3c159e6cfb4879f5adae1092927483f
Author: Corinna Vinschen <corinna@vinschen.de>
Date:   Wed Oct 19 12:48:40 2016 +0200

    Fix regression in console charset handling
    	Commit d16a5630 dropped usage of cygheap's locale functions
    	in favor of local on-the-fly usage of UTF-8 instead of ASCII.
    	This allowed to use the current local rather than a fixed
    	system-wide locale set at startup time.  d16a5630 just missed
    	to add the ASCII->UTF-8 conversion in the console as well.
    	Fixes https://cygwin.com/ml/cygwin/2016-10/msg00000.html
    Signed-off-by: Corinna Vinschen <corinna@vinschen.de>

 winsup/cygwin/fhandler_console.cc | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/winsup/cygwin/fhandler_console.cc b/winsup/cygwin/fhandler_console.cc
index 45fe882..2d281e0 100644
--- a/winsup/cygwin/fhandler_console.cc
+++ b/winsup/cygwin/fhandler_console.cc
@@ -2005,6 +2005,8 @@ fhandler_console::write_normal (const unsigned char *src,
   /* The alternate charset is always 437, just as in the Linux console. */
   f_mbtowc = con.get_console_cp () ? __cp_mbtowc (437) : __MBTOWC;
+  if (f_mbtowc == __ascii_mbtowc)
+    f_mbtowc = __utf8_mbtowc;
   /* First check if we have cached lead bytes of a former try to write
      a truncated multibyte sequence.  If so, process it. */

More information about the Cygwin-cvs mailing list