Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MySQL and polish words

I have noticed a problem with "non-english" (polish) characters using MySQL.

query "select 'abcde'='ąbćdę'" returns "1" and the strings are not equals ...

could you help me ? :) thx!!!

like image 576
Michal_R Avatar asked Aug 17 '10 19:08

Michal_R


1 Answers

For utf8_general_ci they are equal (with the exception of ł, which is not considered a bug by MySQL), and since 5.6 you can also use utf8_unicode_520_ci which handles all Polish characters correctly. Use utf8_polish_ci to treat accented and unaccented characters as different.

select 'abcde'='ąbćdę' COLLATE utf8_polish_ci
>> 0

Demo of 'not a bug'

select 'abcde'='ąbćdę' COLLATE utf8_general_ci
>> 1

select 'abcdel'='ąbćdęł' COLLATE utf8_general_ci
>> 0

See the bug report here: http://bugs.mysql.com/bug.php?id=9604

like image 101
Mchl Avatar answered Sep 26 '22 19:09

Mchl