Guys, I'm in trouble.

I'm using the django-tagging application with a Swedish news
application. It generally works, but there's one big problem which has
taken me forever to solve.

I've concluded that the issue lies in the
http://django-tagging.googlecode.com/svn/trunk/tagging/models.py file.
If you look at the __unicode__ method all the way down in the bottom,
it refers to self.object and self.tag. The self.object in my case is
an Article object which __unicode__ method returns the the title of
the Article in a u'%s' % (self.title) format.

The issue is that when this title includes "special" characters (åäö),
it breaks in the admin and gives me an error which looks like this:

DjangoUnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in
position 0: ordinal not in range(128). You passed in <TaggedItem: [Bad
Unicode data]> (<class 'tagging.models.TaggedItem'>)

Another strange thing is that it works on my local machine, but not on
the live server. The local server runs Python 2.5, whereas the live
goes for 2.3.

I was suspecting that it had something to do with the Python encoding
settings, but everything except for this line works. When I remove the
åäö from the titles it works, or if I remove self.object from the
Unicode method as well.

I'm not too experienced with encodings, but I tried something that I
hope could help someone help me with this issue ;)

In my Python console locally:

>>> s = u'ä'
>>> s
u'\xe4'

And on my live server:

>>> s = u'ä'
>>> s
u'\xc3\xa4'

I don't know if that helps anyone, but I sure hope so.

Thanks in advance,

Alex
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
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