public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* Re: [glibc] intl: Treat C.UTF-8 locale like C locale (BZ# 16621)
       [not found] <20230904133149.E22D83858425@sourceware.org>
@ 2023-09-04 13:45 ` Andreas Schwab
  2023-09-04 14:26   ` Florian Weimer
  0 siblings, 1 reply; 2+ messages in thread
From: Andreas Schwab @ 2023-09-04 13:45 UTC (permalink / raw)
  To: libc-alpha; +Cc: Florian Weimer

On Sep 04 2023, Florian Weimer via Glibc-cvs wrote:

> 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;

Should this also cover the "POSIX" locale?  What about the reference to
"C" in dcigettext?

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

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

* Re: [glibc] intl: Treat C.UTF-8 locale like C locale (BZ# 16621)
  2023-09-04 13:45 ` [glibc] intl: Treat C.UTF-8 locale like C locale (BZ# 16621) Andreas Schwab
@ 2023-09-04 14:26   ` Florian Weimer
  0 siblings, 0 replies; 2+ messages in thread
From: Florian Weimer @ 2023-09-04 14:26 UTC (permalink / raw)
  To: Andreas Schwab via Libc-alpha; +Cc: Andreas Schwab

* Andreas Schwab via Libc-alpha:

> On Sep 04 2023, Florian Weimer via Glibc-cvs wrote:
>
>> 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;
>
> Should this also cover the "POSIX" locale?

"POSIX.UTF-8" is not a valid locale string, as far as I can tell, so we
do not have to treat "POSIX" differently in this context.  Plain "POSIX"
seems to have been normalized to "C" at this point.

> What about the reference to "C" in dcigettext?

The remaining references allow having different messages for C and
C.UTF-8, maybe with added Unicode punctuation characters.  That seems
useful.

Thanks,
Florian


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

end of thread, other threads:[~2023-09-04 14:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20230904133149.E22D83858425@sourceware.org>
2023-09-04 13:45 ` [glibc] intl: Treat C.UTF-8 locale like C locale (BZ# 16621) Andreas Schwab
2023-09-04 14:26   ` 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).