Karen, Thank you very much. Our collation is set to utf8_bin, which
was the source of the problem. Adam

On Aug 17, 9:01 pm, Karen Tracey <kmtra...@gmail.com> wrote:
> 2010/8/17 adam <adus...@gmail.com>
>
>
>
>
>
> > When I connect directly to mysql using the mysql client program, I see
> > that my table contains utf-8 data. Here are the environment settings:
>
> > mysql> SHOW VARIABLES LIKE '%character%';
> > [snip]
>
> > However, when I access my model through the django shell, I have
> > problems:
>
> > In [4]: video = models.Video.objects.get(video_id='i265mCSdlsEl')
> > In [5]: video.title
> > Out[5]: '\xd1\x80\xd1\x83\xd1\x81\xd1\x81\xd0\xba\xd0\xb8\xd0\xb9
> > \xd1\x8f\xd0\xb7\xd1\x8b\xd0\xba'
> > In [6]: video.title == u'русский язык'
> > manage.py:1: UnicodeWarning: Unicode equal comparison failed to
> > convert both arguments to Unicode - interpreting them as being unequal
> >  # Universal Subtitles, universalsubtitles.org
> > Out[6]: False
> > In [7]: str = u'русский язык'
> > In [8]: str
> > Out[8]: u'\xd1\x80\xd1\x83\xd1\x81\xd1\x81\xd0\xba\xd0\xb8\xd0\xb9
> > \xd1\x8f\xd0\xb7\xd1\x8b\xd0\xba'
>
> > I'm hoping that there is some obvious solution to this, since we're at
> > our wits' end. Any suggestions would be of great use.
>
> This looks like a collation issue, not a character set issue. You seem to be
> getting bytestrings returned from the database instead of unicode. The only
> way I know to have that happen is to set the collation for the table/column
> to a binary one. See:
>
> http://docs.djangoproject.com/en/dev/ref/databases/#collation-settings
>
> Karen
> --http://tracey.org/kmt/

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

Reply via email to