Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

JSON Unicode Decoding bug when using simplejson (e.g. for DynamoDB) #1451

Open
MajorTal opened this Issue Apr 21, 2013 · 0 comments

Comments

Projects
None yet
1 participant

There is a known, refused-to-be-fixed bug in simplejson:

>>> import simplejson as json
>>> dump = json.dumps((u"$123", u"₪123"))
>>> [type(object) for object in json.loads(dump)] 
[<type 'str'>, <type 'unicode'>] # This is bad!

vs.

>>> import json
>>> dump = json.dumps((u"$123", u"₪123"))
>>> [type(object) for object in json.loads(dump)] 
[<type 'unicode'>, <type 'unicode'>] # This is good!

https://code.google.com/p/simplejson/issues/detail?id=40

http://python.6.x6.nabble.com/simplejson-2-0-0-released-much-faster-td2211801.html

I think that when using simplejson (boto.compat.py) and running json.loads() (boto.dynamodb.layer1.py#make_request) the result must be a unicode string consistently.

Specifically, I'm running:

item = table.get_item("testing123", "11e2-8414-a5e9e0fd-95a6-12313913cc26")
input_text = item['input_text'] 

And sometimes getting a string and sometimes getting a unicode...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment