From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2155) id E96E6384D18E; Fri, 24 Mar 2023 11:52:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E96E6384D18E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1679658721; bh=oy9ErDoVZ8PrTba3mw/FvaEb6Hsiirjl+pgy+6GJdlQ=; h=From:To:Subject:Date:From; b=NvQ9z3Pj4cL+9LoR92uQJpRy9Umfan/KVMfVW/bxPewfWOW7l4pmD276QXzA3YeX1 o8QZlh5qTfVD+qp5eMEqXJne/mViGG0aS9E9LwzYdyNEYDkYv/m9a892NmUR4pQYL+ nBPRXwOEgWP0Z8VzIF/smWZgBs+L8sICHDQ3aXc8= 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: /proc/locales: fix sd_IN locale X-Act-Checkin: newlib-cygwin X-Git-Author: Corinna Vinschen X-Git-Refname: refs/heads/main X-Git-Oldrev: 606373e7d2e7009209ca536ab1c9c3393af61275 X-Git-Newrev: 9296f134fb5aa808893d5bbf68b84d6b1edc193b Message-Id: <20230324115201.E96E6384D18E@sourceware.org> Date: Fri, 24 Mar 2023 11:52:01 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dnewlib-cygwin.git;h=3D9296f134fb5= aa808893d5bbf68b84d6b1edc193b commit 9296f134fb5aa808893d5bbf68b84d6b1edc193b Author: Corinna Vinschen AuthorDate: Fri Mar 24 11:47:23 2023 +0100 Commit: Corinna Vinschen CommitDate: Fri Mar 24 12:50:59 2023 +0100 Cygwin: /proc/locales: fix sd_IN locale =20 Due to the way locales are evaluated in Windows, we can't ask for the script of the "sd-IN" locale, because Windows only knows the "sd-Deva-IN" locale. So asking for the script of the "sd" locale returns "Arab;", because "sd" is converted to "sd-Arab-PK". =20 Special case "sd-IN" to workaround that issue. =20 Fixes: c42b98bdc665 ("Cygwin: introduce /proc/codesets and /proc/locale= s") Signed-off-by: Corinna Vinschen Diff: --- winsup/cygwin/fhandler/proc.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/winsup/cygwin/fhandler/proc.cc b/winsup/cygwin/fhandler/proc.cc index d5e3c60fcf1a..3dc0421a53b4 100644 --- a/winsup/cygwin/fhandler/proc.cc +++ b/winsup/cygwin/fhandler/proc.cc @@ -2193,6 +2193,11 @@ format_proc_locale_proc (LPWSTR win_locale, DWORD in= fo, LPARAM param) else return TRUE; } + /* "sd-IN" is no valid Windows locale, only "sd-Deva-IN" is. However, + asking for LOCALE_SSCRIPTS below returns "Arab;" because the first "s= d" + locale Windows finds is "sd-Arab-PK", so we have to override this her= e. */ + else if (!wcscmp (iso639, L"sd") && !wcscmp (iso3166, L"IN")) + strcpy (posix_loc, "sd_IN"); /* In all other cases, we check if the script from the Windows locale is the default locale in that language. If not, we add it as modifier if possible, or skip it */ @@ -2242,8 +2247,10 @@ format_proc_locale_proc (LPWSTR win_locale, DWORD in= fo, LPARAM param) changing the codeset and other stuff. */ if (!wcscmp (iso639, L"be") && !wcscmp (iso3166, L"BY")) stpcpy (modifier, "@latin"); - if (!wcscmp (iso639, L"tt") && !wcscmp (iso3166, L"RU")) + else if (!wcscmp (iso639, L"tt") && !wcscmp (iso3166, L"RU")) stpcpy (modifier, "@iqtelif"); + else if (!wcscmp (iso639, L"sd") && !wcscmp (iso3166, L"IN")) + stpcpy (modifier, "@devanagari"); /* If the base locale is ISO-8859-1 and the locale defines currency as EUR, add a @euro locale. For historical reasons there's also a greek @euro locale, albeit it doesn't change the codeset. */