
I have a LATIN-1 encoded file on a UTF-8 configured system: $ iconv -f latin1 Text Häßkell $ echo $LANG de_DE.UTF-8 Thus, a Haskell program cannot process it as it is: $ cat Text | ghc-8.2.2 -e 'interact id' | iconv -f latin1 <interactive>: <stdin>: hGetContents: invalid argument (invalid byte sequence) So far, so expected. Now I want to run it with latin encoding: $ cat Text | (LANG=de_DE ghc-8.2.2 -e 'interact id') | iconv -f latin1 <interactive>: <stdin>: hGetContents: invalid argument (invalid byte sequence) That's unexpected. Is this the reason: $ LANG=de_DE ghc-8.2.2 -e 'print System.IO.localeEncoding' ASCII ? Btw. what would be the Locale name for Latin-1 encoding?

On Fri, 17 Nov 2017, Henning Thielemann wrote:
That's unexpected. Is this the reason:
$ LANG=de_DE ghc-8.2.2 -e 'print System.IO.localeEncoding' ASCII
? Btw. what would be the Locale name for Latin-1 encoding?
I see, the de_DE locale was missing on my system. I did: $ sudo locale-gen de_DE Generating locales (this might take a while)... de_DE.ISO-8859-1... done Generation complete. Now I get: $ LANG=de_DE ghc-8.2.2 -e 'print System.IO.localeEncoding' ISO-8859-1 and everything works perfectly.
participants (1)
-
Henning Thielemann