1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-06-06 11:41:02 +03:00

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>
This commit is contained in:
Bruno Haible 2023-09-04 15:31:36 +02:00 committed by Florian Weimer
parent 8076906109
commit 2897b231a6

View File

@ -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 2. The precise output of some programs in the "C" locale is specified
by POSIX and should not depend on environment variables like by POSIX and should not depend on environment variables like
"LANGUAGE" or system-dependent information. We allow such programs "LANGUAGE" or system-dependent information. We allow such programs
to use gettext(). */ to use gettext().
if (strcmp (locale, "C") == 0) 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; return locale;
/* The highest priority value is the value of the 'LANGUAGE' environment /* The highest priority value is the value of the 'LANGUAGE' environment