Opened 17 years ago
Closed 12 years ago
#6234 closed Bug (fixed)
Serialization with JSON and UTF-8, "ensure_ascii=False" invalid now?
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Core (Serialization) | Version: | 1.2 |
Severity: | Normal | Keywords: | json ensure_ascii utf-8 utf8 |
Cc: | Sindre Sorhus | Triage Stage: | Accepted |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
The bottom of page:
http://www.djangoproject.com/documentation/serialization/
says for JSON you should specify:
ensure_ascii=False
This appears not to be the case, as latest trunk actually generates an exception when a unicode character is hit with "ensure_ascii=False". This seems to be two problems depending on your perspective, but I'm not sure how to tackle this.
(1) Removing the ensure_ascii parameter allows the serializer to generate UTF-8 encoded characters. (consequence of UTF-8 branch merge?)
(2) Documentation tells you to do something that actually generates an exception.
Change History (8)
comment:1 by , 17 years ago
comment:2 by , 17 years ago
I've found this to be true also. The docs need to be updated or the the trunk needs to be patched. This is really confusing...! E
comment:3 by , 17 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:4 by , 15 years ago
Version: | SVN → 1.2 |
---|
This bug still happens in the latest 1.2 release of Django. Another user asked for help here a long time ago:
http://groups.google.com/group/django-users/browse_thread/thread/4f5f99b730ee0aae/db766ece1dcc78fe#db766ece1dcc78fe
Simply omitting ensure_ascii parameter resolves the issue even though it makes no sense. Having ensure_ascii=False should properly deal with unicode characters, after all, that is what this parameter is for.
Regards
comment:5 by , 14 years ago
Severity: | → Normal |
---|---|
Type: | → Bug |
comment:6 by , 14 years ago
Cc: | added |
---|---|
Easy pickings: | unset |
Can someone update the docs? I got into the same problem too.
comment:8 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Fixed in master [4e8d9524c62d071718a85d1d55a18310be91b4f7] and in 1.5 branch [b61778dcf642341c831041ab103ee0545eb8a1e6].
I just ran into this one myself. Removing ensure_ascii=False seems to have fixed my problem. The docs need to be updated...