Opened 10 years ago

Closed 5 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 Changed 10 years ago by anonymous

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 Changed 10 years ago by anonymous

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 Changed 10 years ago by Jacob

Triage Stage: UnreviewedAccepted

comment:4 Changed 8 years ago by roklenardic

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 Changed 7 years ago by Julien Phalip

Severity: Normal
Type: Bug

comment:6 Changed 7 years ago by Sindre Sorhus

Cc: Sindre Sorhus added
Easy pickings: unset

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

comment:7 Changed 6 years ago by Aymeric Augustin

UI/UX: unset

Change UI/UX from NULL to False.

comment:8 Changed 5 years ago by Claude Paroz

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