[Haskell-cafe] latin file encoding

Henning Thielemann lemming at henning-thielemann.de
Fri Nov 17 09:38:07 UTC 2017


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?


More information about the Haskell-Cafe mailing list