Averroes / simplejson

MIT License
0 stars 0 forks source link

Problem with simplejson.dumps #19

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I am writing a resource requirement agent. For example, if I send GET
/fetch?url=http://www.google.com to the agent, then it will get the webpage
for me. And I use simplejson as the return format. The problem is that I
don't know the encoding of the page, then I don't know how to use
simplejson.dumps. I usually got errors like

 this:exceptions.UnicodeDecodeError: 'utf8' codec can't decode bytes in
position 322-323: invalid data

Actually I don't care about the oringal encoding of the page, I just want
to return it to user in simplejson string.
Thanks a lot!

Original issue reported on code.google.com by Flyin...@gmail.com on 30 Aug 2008 at 5:50

GoogleCodeExporter commented 9 years ago
You can't return a valid JSON string unless you know the encoding... Solving 
this problem is outside the scope of 
simplejson, and there is no binary type in JSON. You could base64 encode the 
document or something like that I 
guess, but that's about it.

Original comment by bob.ippo...@gmail.com on 30 Aug 2008 at 6:31