From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2155) id DEA24385840A; Sun, 26 Mar 2023 12:18:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DEA24385840A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1679833091; bh=0eukaYQtIU6RFlWx0XxsJlKUyUW9sVD2j3iGqc/ONfM=; h=From:To:Subject:Date:From; b=bWDn8Y27EZ7rwB7Dk4lShDyZy+PAu70rfiw451amqbBQPphlpDIZ1K320w6vshzmG bxAumjMcmelEPMG7sgoVAH57Cz47r9c2UJpCWZOHXqR+x+7bgRCmHLIOmtdKeZIYGF MlGJk+cHaFKvXhUOzt7/83sCemI7vANM6gKtHg1s= 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 @cjk* and @euro locales X-Act-Checkin: newlib-cygwin X-Git-Author: Corinna Vinschen X-Git-Refname: refs/heads/main X-Git-Oldrev: 68aea16d3f4081cc2af420afe223573526cfcf83 X-Git-Newrev: c3e7f7609e46383ee7952f6ab3345abfb535d7a4 Message-Id: <20230326121811.DEA24385840A@sourceware.org> Date: Sun, 26 Mar 2023 12:18:11 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dnewlib-cygwin.git;h=3Dc3e7f7609e4= 6383ee7952f6ab3345abfb535d7a4 commit c3e7f7609e46383ee7952f6ab3345abfb535d7a4 Author: Corinna Vinschen AuthorDate: Sun Mar 26 13:01:52 2023 +0200 Commit: Corinna Vinschen CommitDate: Sun Mar 26 13:01:52 2023 +0200 Cygwin: locales: fix behaviour for @cjk* and @euro locales =20 @cjknarrow and @cjkwide modifiers are newlib only, so they need some tweaking in __set_charset_from_locale. =20 Fixes: 2483e54be852e ("Cygwin: locale: Set default charset from Linux l= ocale -> codeset mapping") Signed-off-by: Corinna Vinschen Diff: --- winsup/cygwin/nlsfuncs.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/winsup/cygwin/nlsfuncs.cc b/winsup/cygwin/nlsfuncs.cc index ee44de03e5f6..6821a43c3fb7 100644 --- a/winsup/cygwin/nlsfuncs.cc +++ b/winsup/cygwin/nlsfuncs.cc @@ -1528,7 +1528,7 @@ __set_charset_from_locale (const char *loc, char *cha= rset) { wchar_t win_locale[ENCODING_LEN + 1]; char locale[ENCODING_LEN + 1]; - const char *modifier; + char *modifier; char *c; UINT cp; =20 @@ -1537,6 +1537,12 @@ __set_charset_from_locale (const char *loc, char *ch= arset) modifier =3D strchr (loc, '@'); if ((c =3D strchr (locale, '.'))) stpcpy (c, modifier ?: ""); + /* Cut out @cjknarrow/@cjkwide modifier, both are newlib specials and + don't affect the codeset. */ + modifier =3D strchr (locale, '@'); + if (modifier && (!strcmp (modifier + 1, "cjknarrow") + || !strcmp (modifier + 1, "cjkwide"))) + *modifier =3D '\0'; =20 default_codeset_t srch_dc =3D { locale, NULL }; default_codeset_t *dc =3D (default_codeset_t *)