Insensitivity of filtering to stressed chars

3 views
Skip to first unread message

space0x42

unread,
Apr 24, 2009, 12:24:20 AM4/24/09
to Django users
HI all

This is puzzling me:
django 1.0 with a mysql database, innodb engine, database created with
"character set utf8 collate utf8_general_ci."

Filtering by object name is insensitive to stressed chars!

EntityType.objects.get(name='sven') returns the same object of
EntityType.objects.get(name='svèn')...

This problem is generic, I did several test, both with objects named
with stressed chars and objects with plain names and I always have
both get and filter return the same object despite I pass stressed or
plain version of name...

Did some google search about this, but didn't find anything...am I
missing something obvious?

Karen Tracey

unread,
Apr 24, 2009, 12:35:02 AM4/24/09
to django...@googlegroups.com

This is due to MySQL's default collation. Though the doc here:

http://docs.djangoproject.com/en/dev/ref/databases/#collation-settings

only explicitly calls out case sensitivity the effect you are seeing with accented characters is due to the same cause.  The doc linked above points to the MySQL doc for more information, and gives some guidance on what you'll need to do if you want to change to a stricter (binary equality) collation.

Karen
Reply all
Reply to author
Forward
0 new messages