From patchwork Tue Nov 15 00:56:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruno Haible X-Patchwork-Id: 60617 X-Patchwork-Delegate: fweimer@redhat.com Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 74469384F037 for ; Tue, 15 Nov 2022 00:57:16 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mo4-p00-ob.smtp.rzone.de (mo4-p00-ob.smtp.rzone.de [81.169.146.160]) by sourceware.org (Postfix) with ESMTPS id E21EE38518AB for ; Tue, 15 Nov 2022 00:57:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E21EE38518AB Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=clisp.org Authentication-Results: sourceware.org; spf=none smtp.mailfrom=clisp.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1668473821; s=strato-dkim-0002; d=clisp.org; h=Message-Id:Date:Subject:Cc:To:From:Cc:Date:From:Subject:Sender; bh=JfsGpghmDZM1sJBDxxLAhbV9WlJAro3hk62etR6EBME=; b=GJ0mkqYJMzg4YIigoqoa6+EmRXOVjZCuLfslPJKbXC/g72NsY7JXBIANGxBHG0WbuX EoZQ2uZjw/RZlQaTlckYljnow/wUdFEjju04IsozDzhRYnbSPlw/ThyJsmkpx0YQ9Q/k Tn3EnNjtCHNQN4fCRngdFFE7nUe0R8WtIZpTumZb6QZzRgdlmBH1BuiJSJtAmURhMA0m AyZQucDurR/OH5hJQH6ezExiPFsyRYeNzEQRE+JfyqBkIaPTVLObsMKq+4mlTC9zQGC5 pvR1JroVc7uOrRTORWkgzbEK41qBSSFC/UtxJXT+fYnEE4AEnGG0QC4gcr3oeWzGbBeA iAoA== Authentication-Results: strato.com; dkim=none X-RZG-AUTH: ":Ln4Re0+Ic/6oZXR1YgKryK8brlshOcZlIWs+iCP5vnk6shH0WWb0LN8XZoH94zq68+3cfpPF26eS8oSkn60A0GUzjAXJYguA" X-RZG-CLASS-ID: mo00 Received: from nimes.fritz.box by smtp.strato.de (RZmta 48.2.1 AUTH) with ESMTPSA id v9c7e6yAF0v0qus (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Tue, 15 Nov 2022 01:57:00 +0100 (CET) From: Bruno Haible To: libc-alpha@sourceware.org Cc: Bruno Haible Subject: [PATCH] intl: Treat C.UTF-8 locale like C locale (BZ# 16621) Date: Tue, 15 Nov 2022 01:56:23 +0100 Message-Id: <20221115005623.3774099-1-bruno@clisp.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-10.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" 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 --- intl/dcigettext.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/intl/dcigettext.c b/intl/dcigettext.c index 1fc074a414..6a3c248e68 100644 --- a/intl/dcigettext.c +++ b/intl/dcigettext.c @@ -1564,8 +1564,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