[Haskell-cafe] accents

Daniel Fischer daniel.is.fischer at web.de
Wed Mar 24 06:35:44 EDT 2010


-----Ursprüngliche Nachricht-----
Von: Dupont Corentin <corentin.dupont at gmail.com>
Gesendet: 24.03.2010 11:01:32
An: haskell <haskell-cafe at haskell.org>
Betreff: [Haskell-cafe] accents

>Hello,
>i have a list of french words with accents.
>How could i handle them?
>If i load them with ghci i get:
>
>> a <- readFile "list.txt"
>> head $ lines a
>"abn\233gation"
>
>putStrLn displays a strange character for the "é".
>
>Cheers,
>Corentin

Encoding problem. Either you want System.IO.UTF8.putStrLn (perhaps also readFile), or your file is encoded in latin1 or something and ghci tries to output it as UTF8-encoded.
The secure way would be to iconv the file to utf-8 and use the System.IO.UTF8 I/O-functions.


More information about the Haskell-Cafe mailing list