Error from JSON serializer

126 views
Skip to first unread message

web-junkie

unread,
Jul 5, 2007, 8:13:16 AM7/5/07
to Django users
Hi,

after updating to the trunk with the merged Unicode branch I get
errors for my json pages. Everything is normal until I request
something where it would serialize data with foreign language letters
which comes as Unicode from the database.
And as far as I can tell I have done everything it says in
http://www.djangoproject.com/documentation/unicode/.


File "/usr/local/lib/python2.4/site-packages/django/core/serializers/
__init__.py", line 67, in serialize
s.serialize(queryset, **options)

File "/usr/local/lib/python2.4/site-packages/django/core/serializers/
base.py", line 50, in serialize
self.end_serialization()

File "/usr/local/lib/python2.4/site-packages/django/core/serializers/
json.py", line 26, in end_serialization
simplejson.dump(self.objects, self.stream, cls=DjangoJSONEncoder,
**self.options)

File "/usr/local/lib/python2.4/site-packages/django/utils/simplejson/
__init__.py", line 139, in dump
fp.write(chunk)

UnicodeEncodeError: 'ascii' codec can't encode character u'\xfc' in
position 2: ordinal not in range(128)

web-junkie

unread,
Jul 5, 2007, 9:09:54 AM7/5/07
to Django users
okay, seems this ensure_ascii=False is useless, without it there's no
error.

On 5 Jul., 14:13, web-junkie <web-jun...@gmx.net> wrote:
> Hi,
>
> after updating to the trunk with the merged Unicode branch I get
> errors for my json pages. Everything is normal until I request
> something where it would serialize data with foreign language letters
> which comes as Unicode from the database.

> And as far as I can tell I have done everything it says inhttp://www.djangoproject.com/documentation/unicode/.

Reply all
Reply to author
Forward
0 new messages