latin file encoding

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

latin file encoding

Henning Thielemann

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?
_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.
Reply | Threaded
Open this post in threaded view
|

Re: latin file encoding

Henning Thielemann

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.
_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.