I've recently updated our Django source to the latest version which
meant implementing the Unicode handling. In the main all went well,
although I'm getting a few decode errors such as:

UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position
28: ordinal not in range(128)

I have changed the __str__ to __unicode__ methods in my models and
checked to _str_ methods on model fields. But I can't seem to resolve
one of two of the errors.

In particular I'm getting the error above when I loop through a
queryset in a template. The queryset is called as:

qs=Reward.objects.all().select_related().order_by(add_sort)

This is passed to the template in a render_to_response and then called
in the template as:

 {% for i in qs %}

Which causes the error.

The database is MySQL which was encoded as Latin-1 with
latin1_general_ci as the collation. Although I've changed the Table
settings to utf-8, I suspect, all of the data is still held as
Latin1.

I've checked through/removed a lot of the dto ata in the table in an
attempt to troubleshoot but I have not been able to  get rid of the
error.

I've changed the FILE_CHARSET setting to 'latin-1' -  again without
success.

I'm also getting the error on several tables in the Admin interface.

Questions...
Do I need to recreate the databse and re-load all of the data into the
database to ensure it gets converted to utf-8?
When defining the queryset, can I ensure that the object returned is
forced to be unicode compatible?

I seem to be going round in circles on this one, so I'd be grateful
for any advice in trouble shooting the problem.

Cheers ... Tim


--~--~---------~--~----~------------~-------~--~----~
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