On Wed, 2007-07-11 at 05:56 +0000, qhfgva wrote:
> Well, I upgraded to the trunk version of django and now my error looks
> like this:
> 
> UnicodeDecodeError: 'utf8' codec can't decode byte 0x94 in position 6:
> unexpected code byte
> 
> Not sure if this is much of an improvement.
[...]
> > > Here's an example with a fancy right quote char:
> >
> > >>>> p.number = '53 5/8\x94H x 21\x94D x 47 1/4\x94L'

If you are still using this example, then it's not too surprising you
are seeing this error. Bytestrings (normal Python strings) must use
UTF-8 encoding when passed to Django. Alternatively, you can use Unicode
strings. What you can't do is pass in some arbitrarily encoded sequence
of bytes and hope Django can guess the encoding. It can't do that.

I can't even guess what byte encoding you are using in the above. I
thought it might be cp-1252, but \x94 is closing double quotes there,
not a right quote (that would be \x92). In any case, it's not UTF-8, so
you are going to have problems. Read the section on string handling in
docs/unicode.txt (or
http://www.djangoproject.com/documentation/unicode/#general-string-handling ) 
for more details.

Regards,
Malcolm


-- 
Everything is _not_ based on faith... take my word for it. 
http://www.pointy-stick.com/blog/


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to