public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin/main] Cygwin: locales: fix behaviour for @euro locales
@ 2023-03-26 12:18 Corinna Vinschen
  0 siblings, 0 replies; only message in thread
From: Corinna Vinschen @ 2023-03-26 12:18 UTC (permalink / raw)
  To: cygwin-cvs

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=2d5492453a4aef0b761800cd89fd41b11af6c2d3

commit 2d5492453a4aef0b761800cd89fd41b11af6c2d3
Author:     Corinna Vinschen <corinna@vinschen.de>
AuthorDate: Sun Mar 26 13:06:38 2023 +0200
Commit:     Corinna Vinschen <corinna@vinschen.de>
CommitDate: Sun Mar 26 13:06:38 2023 +0200

    Cygwin: locales: fix behaviour for @euro locales
    
    Latest Windows supports more EU locales than GLibc, so some of the
    @euro locales are not covered by checking the GLibc locale defaults.
    Those locales have no long history, they are all UTF-8.  So just
    check for @euro in the UTF-8 case and set them to ISO-8859-15.
    
    Fixes: 2483e54be852e ("Cygwin: locale: Set default charset from Linux locale -> codeset mapping")
    Signed-off-by: Corinna Vinschen <corinna@vinschen.de>

Diff:
---
 winsup/cygwin/nlsfuncs.cc | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/winsup/cygwin/nlsfuncs.cc b/winsup/cygwin/nlsfuncs.cc
index 6821a43c3fb7..b097a6e5fa0a 100644
--- a/winsup/cygwin/nlsfuncs.cc
+++ b/winsup/cygwin/nlsfuncs.cc
@@ -1610,9 +1610,17 @@ __set_charset_from_locale (const char *loc, char *charset)
       cs = "ISO-8859-13";
       break;
     case 1258:
-    default:
       cs = "UTF-8";
       break;
+    default:
+      /* Some (pretty new) EU locales don't exist in GLibc and haven't been
+	 catched above.  Check for @euro modifier again and make these locales
+	 always use ISO-8859-15. */
+      if (modifier && !strcmp (modifier + 1, "euro"))
+	cs = "ISO-8859-15";
+      else
+	cs = "UTF-8";
+      break;
     }
   stpcpy (charset, cs);
 }

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-03-26 12:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-26 12:18 [newlib-cygwin/main] Cygwin: locales: fix behaviour for @euro locales Corinna Vinschen

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).