From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2155) id E768E385841C; Sun, 26 Mar 2023 12:18:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E768E385841C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1679833096; bh=S/E0Vbti4R4mdU5j5tAatklWjvWsbYsQ2MD3n8QYllk=; h=From:To:Subject:Date:From; b=Ef199CRTJx94bgL0BN2nvhjMQ8uGYnbgZaM1/kT8fOUGqDHpaIUj2OTcIWBWE80aN A1eTGq1ZmgMaD/+mVow1hApGtAjXKSSF6nEFll4n95HmHQexSTcu7G+aL4EtbLO5Ip 4df/gTmStiCvnabIxiWR3MKj9MmyDd4xyb5mMZZ8= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Corinna Vinschen To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin/main] Cygwin: locales: fix behaviour for @euro locales X-Act-Checkin: newlib-cygwin X-Git-Author: Corinna Vinschen X-Git-Refname: refs/heads/main X-Git-Oldrev: c3e7f7609e46383ee7952f6ab3345abfb535d7a4 X-Git-Newrev: 2d5492453a4aef0b761800cd89fd41b11af6c2d3 Message-Id: <20230326121816.E768E385841C@sourceware.org> Date: Sun, 26 Mar 2023 12:18:16 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dnewlib-cygwin.git;h=3D2d5492453a4= aef0b761800cd89fd41b11af6c2d3 commit 2d5492453a4aef0b761800cd89fd41b11af6c2d3 Author: Corinna Vinschen AuthorDate: Sun Mar 26 13:06:38 2023 +0200 Commit: Corinna Vinschen CommitDate: Sun Mar 26 13:06:38 2023 +0200 Cygwin: locales: fix behaviour for @euro locales =20 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. =20 Fixes: 2483e54be852e ("Cygwin: locale: Set default charset from Linux l= ocale -> codeset mapping") Signed-off-by: Corinna Vinschen 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 *ch= arset) cs =3D "ISO-8859-13"; break; case 1258: - default: cs =3D "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 =3D "ISO-8859-15"; + else + cs =3D "UTF-8"; + break; } stpcpy (charset, cs); }