Opened 16 years ago

Closed 12 years ago

#6234 closed Bug (fixed)

Serialization with JSON and UTF-8, "ensure_ascii=False" invalid now?

Reported by: aaron@… 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 anonymous, 16 years ago

I just ran into this one myself. Removing ensure_ascii=False seems to have fixed my problem. The docs need to be updated...

comment:2 by anonymous, 16 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 Jacob, 16 years ago

Triage Stage: UnreviewedAccepted

comment:4 by roklenardic, 14 years ago

Version: SVN1.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 Julien Phalip, 13 years ago

Severity: Normal
Type: Bug

comment:6 by Sindre Sorhus, 13 years ago

Cc: Sindre Sorhus added
Easy pickings: unset

Can someone update the docs? I got into the same problem too.

comment:7 by Aymeric Augustin, 12 years ago

UI/UX: unset

Change UI/UX from NULL to False.

comment:8 by Claude Paroz, 12 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.
Back to Top