From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2178) id E22D83858425; Mon, 4 Sep 2023 13:31:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E22D83858425 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1693834309; bh=YtoH6SVKDltkVVQAQsFQvaPWW7DF9EWlL0E+MXQGq7g=; h=From:To:Subject:Date:From; b=CZY8QuoOeAJtva1ReaWQxocYqym6Ods7yhxDA23qoUqUXQU1F2Bd8gQgHpFShQuH0 fyydh2+4LhyNmIRNlo0r+T55peHhFA08n4l0KmkqmJUvDfKg2sAqDpgNvFxDDeccgl QL7pffoLCJs8MYLh0Aphc7K3pHD1flBTL4KZ2rzY= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Florian Weimer To: glibc-cvs@sourceware.org Subject: [glibc] intl: Treat C.UTF-8 locale like C locale (BZ# 16621) X-Act-Checkin: glibc X-Git-Author: Bruno Haible X-Git-Refname: refs/heads/master X-Git-Oldrev: 807690610916df8aef17cd14bfadd5d4b6e699a9 X-Git-Newrev: 2897b231a6b71ee17d47d3d63f1112b2641a476c Message-Id: <20230904133149.E22D83858425@sourceware.org> Date: Mon, 4 Sep 2023 13:31:49 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=2897b231a6b71ee17d47d3d63f1112b2641a476c commit 2897b231a6b71ee17d47d3d63f1112b2641a476c Author: Bruno Haible Date: Mon Sep 4 15:31:36 2023 +0200 intl: Treat C.UTF-8 locale like C locale (BZ# 16621) The wiki page https://sourceware.org/glibc/wiki/Proposals/C.UTF-8 says that "Setting LC_ALL=C.UTF-8 will ignore LANGUAGE just like it does with LC_ALL=C." This patch implements it. * intl/dcigettext.c (guess_category_value): Treat C. locale like the C locale. Reviewed-by: Florian Weimer Diff: --- intl/dcigettext.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/intl/dcigettext.c b/intl/dcigettext.c index 7886ac9545..27063886d2 100644 --- a/intl/dcigettext.c +++ b/intl/dcigettext.c @@ -1560,8 +1560,12 @@ guess_category_value (int category, const char *categoryname) 2. The precise output of some programs in the "C" locale is specified by POSIX and should not depend on environment variables like "LANGUAGE" or system-dependent information. We allow such programs - to use gettext(). */ - if (strcmp (locale, "C") == 0) + to use gettext(). + Ignore LANGUAGE and its system-dependent analogon also if the locale is + set to "C.UTF-8" or, more generally, to "C.", because that's + the by-design behaviour for glibc, see + . */ + if (locale[0] == 'C' && (locale[1] == '\0' || locale[1] == '.')) return locale; /* The highest priority value is the value of the 'LANGUAGE' environment