[Haskell-cafe] accents

Dupont Corentin corentin.dupont at gmail.com
Fri May 7 11:05:08 EDT 2010


Hello,
i'm still struggling with ghci and accents.

Prelude> "é"
"\233"

I've installed GHC 6.12.1, which gave me a better result:

Prelude> putStrLn "é"
é

but still:

Prelude> "é"
"\233"

I'm trying to search a file with french words with Regex, but i
stumble on accents:

*Main> findRegexFile "abnégation"
[]
*Main> findRegexFile "abn.gation"
["abn\218gation","abn\218gations"]


I don't know the encoding of my file, how to deduce it?
What is the encoding used by ghci? Unicode?
Its seems not be the same since the représentation for "é" is not the
same (\233 and \218).
How to have accented characters in ghci? Can't find any ressources on the net.

Cheers,
Corentin

PS: please let me know is you can't see the accented characters in
this email, i'll send you another version with pictures.


On 3/24/10, Ivan Lazar Miljenovic <ivan.miljenovic at gmail.com> wrote:
> Dupont Corentin <corentin.dupont at gmail.com> writes:
>>> a <- readFile "list.txt"
>>> head $ lines a
>> "abn\233gation"
>>
>> putStrLn displays a strange character for the "é".
>
> That is the escaped form of é.  You have several options:
>
> 1) Use the utf8-string package for I/O
> 2) Use the text package for I/O (and set an encoding)
> 3) GHC 6.12.1 uses the system's locale for encoding; as such if your
> system normally lets you see accented characters then putStrLn,
> etc. will print them out.
>
> --
> Ivan Lazar Miljenovic
> Ivan.Miljenovic at gmail.com
> IvanMiljenovic.wordpress.com
>


More information about the Haskell-Cafe mailing list