I have a Mysql database (in utf8_general_ci) and have to query columns containing special characters. The problem is: queries containing special characters do not retrieve any results – but queries containing the regular version of those characters do.
For instance, if I want to query the word “été”:
- SELECT … WHERE column LIKE % été % will not work.
- SELECT … WHERE column LIKE % ete % will work!
This problem must be due to my encoding (both queries work when done directly in phpMyAdmin).
I use PDO and followed the instruction here (http://stackoverflow.com/questions/279170/utf-8-all-the-way-through) and, when connecting to the database, do exec(“SET CHARACTER SET utf8”) AND exec(“SET collation_connection = ‘utf8_general_ci’”). What bothers me is that, excepted for this search query, the website seems to work perfectly with utf8 both for the display and the database.
I thought that I could operate a transliterate_to_ascii on the strings containing special chars. I’m however afraid that this option is suboptimal, especially for non european languages. Thank you very much for your help!