[Haskell-cafe] UTF-8 problems when decoding JSON data coming from Network.HTTP

Ionut G. Stan ionut.g.stan at gmail.com
Sat Oct 16 18:10:44 EDT 2010


Hi,

I'm trying to decode this JSON response: 
http://github.com/api/v2/json/user/show/igstan

As you can see, the "name" field contains a non-latin character: ț, and 
it appears that Text.JSON. can't decode this response when it comes from 
Network.HTTP. I've tried Network.HTTP.Enumerator too, but the problem 
persists. Here's a simple (hopefully) reproducible test case:

http://gist.github.com/630319

If you load it in ghci and call "main", you'll see that it doesn't 
properly show the user name. Also, calling:

     request "http://github.com/api/v2/json/user/show/igstan"

will display the respective character encoded in a way that I have no 
idea whether or not is correct (Unicode is not one of my strong points 
for the moment).

Can anyone shed some light on this problem? Which package is the culprit?

Thanks,
-- 
Ionuț G. Stan  |  http://igstan.ro


More information about the Haskell-Cafe mailing list