From: Florian Weimer via Libc-alpha <libc-alpha@sourceware.org>
To: Bruno Haible <bruno@clisp.org>
Cc: libc-alpha@sourceware.org
Subject: Re: [PATCH] intl: Treat C.UTF-8 locale like C locale (BZ# 16621)
Date: Mon, 04 Sep 2023 15:34:55 +0200 [thread overview]
Message-ID: <87il8qukn4.fsf@oldenburg3.str.redhat.com> (raw)
In-Reply-To: <20221115005623.3774099-1-bruno@clisp.org> (Bruno Haible's message of "Tue, 15 Nov 2022 01:56:23 +0100")
* 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.<encoding> 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.<encoding>", because that's
> + the by-design behaviour for glibc, see
> + <https://sourceware.org/glibc/wiki/Proposals/C.UTF-8>. */
> + 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 <fweimer@redhat.com>
Fix pushed. I've posted my test case as well:
[PATCH] intl: Add test case for bug 16621
<https://inbox.sourceware.org/libc-alpha/87o7iiukpt.fsf@oldenburg3.str.redhat.com/T/#u>
Thanks,
Florian
next prev parent reply other threads:[~2023-09-04 13:35 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-15 0:56 [PATCH] intl: Treat C.UTF-8 locale like C locale (BZ# 16621) Bruno Haible
2023-09-04 13:34 ` Florian Weimer via Libc-alpha [this message]
2023-09-10 19:10 ` Bruno Haible
-- strict thread matches above, loose matches on Subject: below --
2023-11-20 18:12 Bruno Haible
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/libc/involved.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87il8qukn4.fsf@oldenburg3.str.redhat.com \
--to=libc-alpha@sourceware.org \
--cc=bruno@clisp.org \
--cc=fweimer@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).