Oh, its worth noting:
- r8321.
- MySQL backend
- utf8 /utf8_bin charset/collation
On Aug 14, 2:58 pm, davenaff <daven...@gmail.com> wrote:
> Is this a bug, or am I doing something wrong?
>
> A sample models.py:
> class Article(models.Model):
> headline = models.CharField(max_length=100)
>
> def __unicode__(self):
> return u'%s' %self.headline
So to be safe, the MySQLdb connector (as of the 1.1.2 level)
We have a function that already knows how to do all that testing:
django.utils.encoding.force_unicode()
Given any unicode, UTF-8 or object that knows how to turns itself into
unicode input, it returns a unicode string. Exactly for situations like
this.
Regards,
Malcolm
>
There's not really any bug here (certainly not with Django, and probably
not with MySQLdb either(. We just can't do anything about it,
unfortunately. MySQL returns an inconsistent result. It's for cases like
that that force_unicode() exists and you should just use it if you're
using MySQL and want to use utf8_bin collation.
Regards,
Malcolm