If you can change the character set of your column (or table), set utf8_general_ci for it ( link to manual )
ALTER TABLE tbl_name CONVERT TO CHARACTER SET utf8_general_ci;
With this character set (which is case-insensitive, as _ci stands _ci ), accented characters have the same weight (the value used for collation ), so they return true compared to each other ( reference to manual ):
Non-UCA sorts have a one-to-one mapping from character code to weight. In MySQL, such comparisons are case insensitive and accent insensitive. utf8_general_ci - example: 'a', "A", "A" and "each" have different character codes, but all have a weight of 0x0041 and compare them as equal.
mysql> SET NAMES 'utf8' COLLATE 'utf8_general_ci'; Query OK, 0 rows affected (0.00 sec) mysql> SELECT 'a' = 'A', 'a' = 'Γ', 'a' = 'Γ‘'; +-----------+-----------+-----------+ | 'a' = 'A' | 'a' = 'Γ' | 'a' = 'Γ‘' | +-----------+-----------+-----------+ | 1 | 1 | 1 | +-----------+-----------+-----------+ 1 row in set (0.06 sec)
Alternatively, or if you cannot change the database configuration in this way, you can write a function to replace accented characters with their equivalents without an accent (i.e. Γ© β e ) and write them in the highlighted search field (a full-text search ). Search in this field and return the accented field to the application.
source share