[Haskell-cafe] setting ISO-8859-1 encoding on Raspbian for GHC

Viktor Dukhovni ietf-dane at dukhovni.org
Wed Jul 15 16:14:24 UTC 2020


On Wed, Jul 15, 2020 at 05:56:32PM +0200, Henning Thielemann wrote:

> >> pi at 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 at 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.


More information about the Haskell-Cafe mailing list