These two querys gives me the exact same result:
select * from topics where name='Harligt';
select * from topics where name='Härligt';
How is this possible? Seems like mysql translates åäö to aao when it searches. Is there some way to turn this off?
I use utf-8 encoding everywhere as far as i know. The same problem occurs both from terminal and from php.
Yes, this is standard behaviour in the non-language-specific unicode collations.
9.1.13.1. Unicode Character Sets
See also Examples of the effect of collation
You need to either
use a collation that doesn’t have this "feature" (namely
utf8_bin, but that has other consequences)use a different collation for the query only. This should work:
it becomes more difficult if you want to do a case insensitive
LIKEbut not have theÄ = Aumlaut conversion. I know no mySQL collation that is case insensitive and does not do this kind of implicit umlaut conversion. If anybody knows one, I’d be interested to hear about it.Related: