I have a MySQL database with words containing accents in Spanish (áéíóú). I\'d like to know if there\'s any way to do a diacritic insensitive search. For instance, if I sear
If you set the table's charset to UTF-8 and the collation to utf8_*_ci (_ci means "case insensitive) MySQL will perform case and accent-insensitive searches by default
Read more about charsets and collations here:
http://dev.mysql.com/doc/refman/5.1/en/charset-charsets.html
I tested it and
"lapiz" matches: "lápiz," "lapíz," and "lapiz"
"nino" matches: "niño," "ninó," and "nino"
You can set up the collation of your table upon creation:
CREATE TABLE table ( ... )
CHARACTER SET uft8 COLLATE utf8_general_ci;
Or you can ALTER it if it already exists.For more info, read the manual (link above).
If you are using phpMyAdmin, you can select the collation when you create your table.