]> sourceware.org Git - newlib-cygwin.git/commitdiff
Cygwin: locales: fix behaviour for @cjk* and @euro locales
authorCorinna Vinschen <corinna@vinschen.de>
Sun, 26 Mar 2023 11:01:52 +0000 (13:01 +0200)
committerCorinna Vinschen <corinna@vinschen.de>
Sun, 26 Mar 2023 11:01:52 +0000 (13:01 +0200)
@cjknarrow and @cjkwide modifiers are newlib only, so they need
some tweaking in __set_charset_from_locale.

Fixes: 2483e54be852e ("Cygwin: locale: Set default charset from Linux locale -> codeset mapping")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
winsup/cygwin/nlsfuncs.cc

index ee44de03e5f66ddcd3fdedea4980661be2332220..6821a43c3fb7b7eb9012c79c4e4673b957e699ef 100644 (file)
@@ -1528,7 +1528,7 @@ __set_charset_from_locale (const char *loc, char *charset)
 {
   wchar_t win_locale[ENCODING_LEN + 1];
   char locale[ENCODING_LEN + 1];
-  const char *modifier;
+  char *modifier;
   char *c;
   UINT cp;
 
@@ -1537,6 +1537,12 @@ __set_charset_from_locale (const char *loc, char *charset)
   modifier = strchr (loc, '@');
   if ((c = strchr (locale, '.')))
     stpcpy (c, modifier ?: "");
+  /* Cut out @cjknarrow/@cjkwide modifier, both are newlib specials and
+    don't affect the codeset. */
+  modifier = strchr (locale, '@');
+  if (modifier && (!strcmp (modifier + 1, "cjknarrow")
+                  || !strcmp (modifier + 1, "cjkwide")))
+    *modifier = '\0';
 
   default_codeset_t srch_dc = { locale, NULL };
   default_codeset_t *dc = (default_codeset_t *)
This page took 0.033133 seconds and 5 git commands to generate.