[Haskell-cafe] How to deal with utf-8?

Duncan Coutts duncan.coutts at worc.ox.ac.uk
Fri Feb 13 04:54:21 EST 2009


On Fri, 2009-02-13 at 08:33 +0100, Krzysztof Skrzętnicki wrote:
> On Fri, Feb 13, 2009 at 08:06, Magicloud <magicloud.magiclouds at gmail.com> wrote:
> > Hi,
> >   I am using Text.CSV to read and using gtk2hs to display csv files using
> > utf-8 encode. Well, it displays broken strings, seems like it cannot deal
> > with utf-8.
> >   What should I do?
> 
> You should try using functions from utf8-string package (find it on
> Hackage) to read UTF-8 encoded data.
> That's about reading data in. I'm not so sure however about the gtk2hs
> part. Experts should tell you if it is possible or not. (I think it
> is.)

Gtk2Hs displays Haskell Strings correctly. Haskell Strings are Unicode.
So all you need to do is decode utf8 into a proper Haskell String.

Duncan



More information about the Haskell-Cafe mailing list