This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2010年10月27日 20:41 by barry, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Messages (4) | |||
|---|---|---|---|
| msg119732 - (view) | Author: Barry A. Warsaw (barry) * (Python committer) | Date: 2010年10月27日 20:41 | |
json is defined as mapping the JSON string type into unicodes. This works as advertised in Python 2.6 and 3, but in Python 2.7 it returns a str.
% python2.6 -c "import json; print json.loads('{\"foo\":\"bar\"}')"
{u'foo': u'bar'}
% python2.7 -c "import json; print json.loads('{\"foo\":\"bar\"}')"
{'foo': 'bar'}
Platform tested so far: Ubuntu 10.10 amd64.
|
|||
| msg119733 - (view) | Author: Barry A. Warsaw (barry) * (Python committer) | Date: 2010年10月27日 20:42 | |
BTW, the workaround for Python 2.7 is to pass a unicode to json.loads(). |
|||
| msg119735 - (view) | Author: Antoine Pitrou (pitrou) * (Python committer) | Date: 2010年10月27日 20:43 | |
Duplicate of issue10038. |
|||
| msg119738 - (view) | Author: Barry A. Warsaw (barry) * (Python committer) | Date: 2010年10月27日 20:49 | |
Yay. I guess I have to submit a tracker bug now because searching for "json unicode" didn't turn up the original bug. ;/ Thanks for duping it __ap__. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:07 | admin | set | github: 54425 |
| 2010年10月27日 20:49:53 | barry | set | messages: + msg119738 |
| 2010年10月27日 20:43:55 | pitrou | set | status: open -> closed nosy: + pitrou messages: + msg119735 superseder: json.loads() on str should return unicode, not str resolution: duplicate |
| 2010年10月27日 20:42:17 | barry | set | messages: + msg119733 |
| 2010年10月27日 20:41:16 | barry | create | |