[Haskell-cafe] HDBC 2.1, UTF8 and Umlauts

Jeremy Shaw jeremy at n-heptane.com
Mon May 4 16:52:58 EDT 2009


At Mon, 04 May 2009 11:19:38 -0500,
John Goerzen wrote:

> but instead just typed the umlaut on the keyboard?
> 
> If so, that won't work directly -- I think.  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.  Then you will get a String which is supposed to have
>  decoded Unicode data, instead having encoded UTF-8 data.

As far as I know, that is how it would work. You type an umlaut on the
keyboard in the source code, and at runtime you have a value of type
'String' which contains the Unicode value for an umlaut.

I am confused why that would not work directly? (Though, I have never
used HDBC). It seems to be that the only way to keep things sensible
is if all values of type 'String' *only* ever contain Unicode
chars. If you need a utf-8 encoded 'string' then it should use a
different type -- perhaps a newtype wrapper around a plain old
bytestring.

- jeremy




More information about the Haskell-Cafe mailing list