unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] intl: Treat C.UTF-8 locale like C locale (BZ# 16621)
@ 2022-11-15  0:56 Bruno Haible
  2023-09-04 13:34 ` Florian Weimer via Libc-alpha
  0 siblings, 1 reply; 4+ messages in thread
From: Bruno Haible @ 2022-11-15  0:56 UTC (permalink / raw)
  To: libc-alpha; +Cc: 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
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread
* Re: [PATCH] intl: Treat C.UTF-8 locale like C locale (BZ# 16621)
@ 2023-11-20 18:12 Bruno Haible
  0 siblings, 0 replies; 4+ messages in thread
From: Bruno Haible @ 2023-11-20 18:12 UTC (permalink / raw)
  To: libc-alpha, Florian Weimer

Hi Florian,

Thanks for your test case [1]. Looks good to me too.

Please consider to commit also the second part of my patch. [2][3][4][5]

This change will not have an effect on your test case.

Bruno

[1] https://sourceware.org/pipermail/libc-alpha/2023-September/151330.html
[2] https://sourceware.org/pipermail/libc-alpha/2023-September/151462.html
[3] https://sourceware.org/pipermail/libc-alpha/2023-September/151463.html
[4] https://sourceware.org/pipermail/libc-alpha/2023-September/151467.html
[5] https://sourceware.org/pipermail/libc-alpha/2023-September/151521.html




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-11-20 18:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2023-09-10 19:10   ` Bruno Haible
  -- strict thread matches above, loose matches on Subject: below --
2023-11-20 18:12 Bruno Haible

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).