Account Options

  1. Sign in
The old Google Groups will be going away soon.
Switch to the new Google Groups.
Google Groups Home
« Groups Home
Unicode JSON Serialization Bug?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
mynameisgabe  
View profile  
 More options Aug 30 2007, 5:12 pm
From: mynameisgabe <mynameisg...@gmail.com>
Date: Thu, 30 Aug 2007 21:12:42 -0000
Local: Thurs, Aug 30 2007 5:12 pm
Subject: Unicode JSON Serialization Bug?
Hello All-

I've been told that I may have encountered a bug - I'm trying to
serialize a model that includes fields that could be unicode data.
Here is the information I collected.  Let me know if there's anything
else that would be helpful.

Specs of the local dev workstation - having the same issues in prod
using Linux/FastCGI:

Windows XP Home Edition Version 2002 SP 2
Python 2.4.4
Latest Django from SVN: 0.97-pre-SVN-6024
SQLite3
Using internal django web server (for dev)

Here's the traceback:

Traceback (most recent call last):
File "C:\Python24\lib\site-packages\django\core\handlers\base.py" in
get_response
 77. response = callback(request, *callback_args, **callback_kwargs)
File "C:\Documents and Settings\Gabe Harriman\My
Documents\dev\texty\cms\views.py" in syndicate
 178. comments = serializers.serialize("json",
texty.comment_set.all(), fields=('name','comment','created_date',),
ensure_ascii=False)
File "C:\Python24\lib\site-packages\django\core\serializers
\__init__.py"
in serialize
 67. s.serialize(queryset, **options)
File "C:\Python24\lib\site-packages\django\core\serializers\base.py"
in serialize
 50. self.end_serialization()
File "C:\Python24\lib\site-packages\django\core\serializers\json.py"
in end_serialization
 26. simplejson.dump(self.objects, self.stream,
cls=DjangoJSONEncoder, **self.options)
File "C:\Python24\lib\site-packages\django\utils\simplejson
\__init__.py" in dump
 139. fp.write(chunk)

 UnicodeEncodeError at /cms/syndicate/d5f8eba5-d4a8-4590-
a3d9-4d9e34503c5b.js
 'ascii' codec can't encode characters in position 1-7: ordinal not
in range(128)

Unicode error hint:
The string that could not be encoded/decoded was: "ﺥﺾﻤﻼﺚﻴﻴ"

As you can see from above, the error starts here:

comments = serializers.serialize("json", texty.comment_set.all(),
fields=('name','comment','created_date',), ensure_ascii=False)

The data in the name field is "ﺥﺾﻤﻼﺚﻴﻴ".  The rest is normal ascii
data.

Let me know if this looks like a bug or not.  If not, I'll keep
hacking away on my end.  Sorry if I left anything out - I'm new to
this whole unicode thing.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
mynameisgabe  
View profile  
 More options Aug 31 2007, 10:04 pm
From: mynameisgabe <mynameisg...@gmail.com>
Date: Sat, 01 Sep 2007 02:04:35 -0000
Local: Fri, Aug 31 2007 10:04 pm
Subject: Re: Unicode JSON Serialization Bug?
Does anyone have any idea about this one?  I'm kind of in a bind on
this one.

Thanks!

Gabe

On Aug 30, 2:12 pm, mynameisgabe <mynameisg...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
mynameisgabe  
View profile  
 More options Aug 31 2007, 10:13 pm
From: mynameisgabe <mynameisg...@gmail.com>
Date: Sat, 01 Sep 2007 02:13:25 -0000
Local: Fri, Aug 31 2007 10:13 pm
Subject: Re: Unicode JSON Serialization Bug?
After doing more searching I ran across this post, claiming that the
ensure_ascii argument was worthless and caused the bug.  I removed it
from the argument list and all is well!!

http://groups.google.com/group/django-users/browse_thread/thread/87b1...

Is this bug documented?

G

On Aug 30, 2:12 pm, mynameisgabe <mynameisg...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »