setting ISO-8859-1 encoding on Raspbian for GHC

On Raspbian Buster I get: pi@raspberrypi:~ $ LANG=de_DE ghc -e 'print System.IO.localeEncoding' UTF-8 pi@raspberrypi:~ $ LANG=de_DE.iso88591 ghc -e 'print System.IO.localeEncoding' UTF-8 pi@raspberrypi:~ $ LANG=de_DE@euro ghc -e 'print System.IO.localeEncoding' UTF-8 Which is not, what I want. On Debian Buster it is correct: $ LANG=de_DE ghc -e 'print System.IO.localeEncoding' ISO-8859-1 How can I check whether this is a GHC problem and has anyone an idea how to fix it?

On Wed, Jul 15, 2020 at 05:12:42PM +0200, Henning Thielemann wrote:
On Raspbian Buster I get:
pi@raspberrypi:~ $ LANG=de_DE ghc -e 'print System.IO.localeEncoding' UTF-8 pi@raspberrypi:~ $ LANG=de_DE.iso88591 ghc -e 'print System.IO.localeEncoding' UTF-8 pi@raspberrypi:~ $ LANG=de_DE@euro ghc -e 'print System.IO.localeEncoding' UTF-8
Do you have any other pertinent environment variables set? In particular, either LC_ALL or LC_CTYPE? What is the output of: $ locale -a | grep de_DE
On Debian Buster it is correct:
$ LANG=de_DE ghc -e 'print System.IO.localeEncoding' ISO-8859-1
Do you have any other pertinent environment variables set? In particular, either LC_ALL or LC_CTYPE? What is the output of: $ locale -a | grep de_DE -- Viktor.

On Wed, 15 Jul 2020, Viktor Dukhovni wrote:
On Wed, Jul 15, 2020 at 05:12:42PM +0200, Henning Thielemann wrote:
On Raspbian Buster I get:
pi@raspberrypi:~ $ LANG=de_DE ghc -e 'print System.IO.localeEncoding' UTF-8 pi@raspberrypi:~ $ LANG=de_DE.iso88591 ghc -e 'print System.IO.localeEncoding' UTF-8 pi@raspberrypi:~ $ LANG=de_DE@euro ghc -e 'print System.IO.localeEncoding' UTF-8
Do you have any other pertinent environment variables set? In particular, either LC_ALL or LC_CTYPE?
Aha: pi@raspberrypi:~ $ echo $LC_ALL de_DE.UTF-8 debian-buster$ echo $LC_ALL Actually, setting LC_ALL to the empty string solves the problem!

On Wed, Jul 15, 2020 at 05:56:32PM +0200, Henning Thielemann wrote:
pi@raspberrypi:~ $ LANG=de_DE.iso88591 ghc -e 'print System.IO.localeEncoding' UTF-8
Do you have any other pertinent environment variables set? In particular, either LC_ALL or LC_CTYPE?
Aha:
pi@raspberrypi:~ $ echo $LC_ALL de_DE.UTF-8 debian-buster$ echo $LC_ALL
Actually, setting LC_ALL to the empty string solves the problem!
Or better yet, "unset LC_ALL", no point it having an empty setting. On a Fedora 31 system, locale(7) states: If the second argument to setlocale(3) is an empty string, "", for the default locale, it is determined using the following steps: 1. If there is a non-null environment variable LC_ALL, the value of LC_ALL is used. 2. If an environment variable with the same name as one of the categories above exists and is non-null, its value is used for that category. 3. If there is a non-null environment variable LANG, the value of LANG is used. Where by "non-null", the author must have meant non-empty, since the value of an environment variable (that has a value) cannot be NULL, but it can be empty. -- Viktor.

quoth Viktor Dukhovni
Or better yet, "unset LC_ALL", no point it having an empty setting. On a Fedora 31 system, locale(7) states:
If the second argument to setlocale(3) is an empty string, "", for the default locale, it is determined using the following steps:
1. If there is a non-null environment variable LC_ALL, the value of LC_ALL is used.
2. If an environment variable with the same name as one of the categories above exists and is non-null, its value is used for that category.
3. If there is a non-null environment variable LANG, the value of LANG is used.
Where by "non-null", the author must have meant non-empty, since the value of an environment variable (that has a value) cannot be NULL, but it can be empty.
Yes, that's what null means in this context - zero length. I would think the main question is whether other applications are going to be affected by a change to LC_ALL. If that's in doubt, it may be more convenient to apply this as he has done in his examples, on the command line. Donn
participants (3)
-
Donn Cave
-
Henning Thielemann
-
Viktor Dukhovni