[Haskell-cafe] HDBC 2.1, UTF8 and Umlauts

John Goerzen jgoerzen at complete.org
Mon May 4 14:47:58 EDT 2009

Günther Schmidt wrote:
> Hi John,
> what I just noticed is that *all* strings come back as SqlByteStrings.

That's normal, and pretty much irrelevant, since fromSql takes care of it.

It's documented, even: the SqlByteString is assumed to be in UTF-8, and
is decoded when converted to a String.

It is not correct to have \252 in the SqlByteString.  The proper
sequence there is \xc3\xbc.  When converted to String, *then* it should
be \252.

Are you positive you're seeing \252 in the SqlByteString?  That doesn't
make any sense to me.  It's not a valid UTF-8 encoding.

> ie. I get my "Günni", (G\252nni), back as an SqlByteString "G\252nni"  
> instead of an SqlString "G\252nni".
> So when I cast, ie. fromSql x :: String, I get an "G\65533nni", which  
> is where the garbling occurs.
> BTW this is the 3rd time now that I'm writing the same bloody email,  
> my email client "clipped" the previous 2.
> Günther

More information about the Haskell-Cafe mailing list