From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 5FE733858428 for ; Mon, 4 Sep 2023 13:34:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5FE733858428 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693834499; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=CXFXKq74vyesROw5PGB/JLD4Lh0pcCf23G/XLPemW1s=; b=OfkSIlxyCv22dXhOzK7j/vfR9zrOtZyaNDIf9oH8zCn3rANtd7d0BBATbiBehfjUCLaA2L yZ2nuhYf/wh0d30zAou55JHJaIeWRGH+NXrJL5XXfUWup1mxlK5/Sx8mKqmF36PNDwM+V3 tGQ/QAJ3wrr85LM1SEIZKxgJiS9uqco= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-168-7Zf2EiSXOWeN2PTe3icUKA-1; Mon, 04 Sep 2023 09:34:57 -0400 X-MC-Unique: 7Zf2EiSXOWeN2PTe3icUKA-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A4C3E803E2E; Mon, 4 Sep 2023 13:34:57 +0000 (UTC) Received: from oldenburg3.str.redhat.com (unknown [10.39.194.68]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0A0EC21D4F3D; Mon, 4 Sep 2023 13:34:56 +0000 (UTC) From: Florian Weimer To: Bruno Haible Cc: libc-alpha@sourceware.org Subject: Re: [PATCH] intl: Treat C.UTF-8 locale like C locale (BZ# 16621) References: <20221115005623.3774099-1-bruno@clisp.org> Date: Mon, 04 Sep 2023 15:34:55 +0200 In-Reply-To: <20221115005623.3774099-1-bruno@clisp.org> (Bruno Haible's message of "Tue, 15 Nov 2022 01:56:23 +0100") Message-ID: <87il8qukn4.fsf@oldenburg3.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-10.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,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 List-Id: * Bruno Haible: > 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. > --- > 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 Reviewed-by: Florian Weimer Fix pushed. I've posted my test case as well: [PATCH] intl: Add test case for bug 16621 Thanks, Florian