[Haskell-beginners] Encoding strings

Daniel Fischer daniel.is.fischer at web.de
Wed Apr 7 16:45:57 EDT 2010


Am Mittwoch 07 April 2010 22:39:39 schrieb legajid:
> Hi,
>
> i experiment problems writing files.
> Reading an access 97 database and displaying data in a wxhaskell grid,
> everything is correct.
> When i write data in a text file, some characters are translated : "é"
> becomes \233.
>
> How to correct this ?
> I looked for hSetEncoding but didn't find it in System.IO, nor in
> GHC.IO.Handle that doesn't exist on my system.
> I tried hSetBinaryMode, without success.

Try

import qualified System.IO.UTF8 as U

and replace

putStrLn, hPutStrLn, writeFile, appendFile, ...

with U.putStrLn, U.hPutStrLn, ...

>
> If this helps, I run ghc 6.10.4 on windows XP.
>
> Thanks for an idea,
> Didier.
>


More information about the Beginners mailing list