[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Warning raised if trying to set LC_ALL to a locale bearing a character t
From: |
Kerin Millar |
Subject: |
Warning raised if trying to set LC_ALL to a locale bearing a character type other than UTF-8 and C |
Date: |
Fri, 1 Jul 2022 14:08:04 +0100 |
Hello,
I was experimenting with locale variables in bash and noticed something that
appears odd. This is with bash 5.1.16 and glibc 2.35.
$ locale -a | grep -E '^en_(US|GB)'
en_GB.utf8
en_US
en_US.iso88591
en_US.utf8
$ locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
$ ( LC_ALL=en_US.ISO-8859-1 )
bash: warning: setlocale: LC_ALL: cannot change locale (en_US.ISO-8859-1)
$ ( LC_ALL=en_GB.UTF-8 )
$ : setting LC_ALL to any of the UTF-8 locales does not raise a warning
Taking Perl as a counter-example, there is no problem issuing the equivalent
setlocale call.
$ perl -MPOSIX=locale_h -E 'if (setlocale(LC_ALL, "en_US.ISO-8859-1")) { say
"Successfully changed LC_ALL to ", setlocale(LC_ALL) }'
Successfully changed LC_ALL to en_US.ISO-8859-1
Is there a particular reason that bash appears to reject the attempt to assign
"en_US.ISO-8859-1" to LC_CTYPE?
--
Kerin Millar
- Warning raised if trying to set LC_ALL to a locale bearing a character type other than UTF-8 and C,
Kerin Millar <=