I'm running MySQL 5.1.50 and have a table that looks like this:
organizations | CREATE TABLE `organizations` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` text CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
`url` text CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
`phone` varchar(20) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
`timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `id` (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=25837 DEFAULT CHARSET=utf8 |
The problem I'm having is that MySQL is matching unicode characters with ascii versions. For example when I search for a word with that contains an 'é', it will match the same word that has an 'e' instead, and vice versa:
mysql> SET NAMES utf8;
Query OK, 0 rows affected (0.00 sec)
mysql> SELECT id, name FROM `organizations` WHERE `name` = 'Universite de Montreal';
+-------+-------------------------+
| id | name |
+-------+-------------------------+
| 16973 | Université de Montreal |
+-------+-------------------------+
1 row in set (0.01 sec)
I get these results both from PHP and the command line console. How can I get accurate matches from my SELECT queries?
Thanks!