[Haskell-cafe] HDBC 2.1, UTF8 and Umlauts

Duncan Coutts duncan.coutts at worc.ox.ac.uk
Mon May 4 14:29:01 EDT 2009


On Mon, 2009-05-04 at 11:19 -0500, John Goerzen wrote:
> Guenther Schmidt wrote:
> > Hi John,
> > 
> > thanks for taking the time. It actually is \252 that turned into 
> > something else because of my email client, damn the thing.
> 
> OK, perhaps we have some confusion here.
> 
> Are you saying that you entered the Unicode characters directly into
> your Haskell source as literals?  In other words, you did not type:
> 
>   backslash two five two
> 
> but instead just typed the umlaut on the keyboard?
> 
> If so, that won't work directly -- I think. 

It should work if one is using an editor that saves files as UTF-8.

> Maybe somebody can correct me on this, but my hunch is that would save
> the umlaut as UTF-8 when you save the .hs file. 

Which is what we want. Since version 6.6, GHC treats .hs files as UTF-8.

> Then you will get a String which is supposed to have decoded Unicode
> data, instead having encoded UTF-8 data.

That's what used to happen prior to GHC version 6.6.

As long as your editor is set to use UTF-8 then String literals
containing Unicode will work fine.

Duncan



More information about the Haskell-Cafe mailing list