public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc] intl: Treat C.UTF-8 locale like C locale (BZ# 16621)
@ 2023-09-04 13:31 Florian Weimer
0 siblings, 0 replies; only message in thread
From: Florian Weimer @ 2023-09-04 13:31 UTC (permalink / raw)
To: glibc-cvs
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=2897b231a6b71ee17d47d3d63f1112b2641a476c
commit 2897b231a6b71ee17d47d3d63f1112b2641a476c
Author: Bruno Haible <bruno@clisp.org>
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.<encoding> locale
like the C locale.
Reviewed-by: Florian Weimer <fweimer@redhat.com>
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.<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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-09-04 13:31 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-04 13:31 [glibc] intl: Treat C.UTF-8 locale like C locale (BZ# 16621) Florian Weimer
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).