Bug #12191 | select * from x where col like '%ä%' doesn't work with UTF8 | ||
---|---|---|---|
Submitted: | 26 Jul 2005 23:24 | Modified: | 27 Jul 2005 1:50 |
Reporter: | Markus Popp | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server | Severity: | S3 (Non-critical) |
Version: | 4.1.13, 5.0.10 | OS: | Windows (Windows, Linux) |
Assigned to: | CPU Architecture: | Any |
[26 Jul 2005 23:24]
Markus Popp
[26 Jul 2005 23:52]
Markus Popp
Right now, I had the same results when I used charset latin1 and collation latin1_german1_ci (which I also used for the client connection).
[27 Jul 2005 0:59]
MySQL Verification Team
Looks here is terminal issue: c:\mysql\bin>mysql -uroot --default_character_set=utf8 test Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1 to server version: 5.0.11-beta-nt Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> set names cp1251; Query OK, 0 rows affected (0.00 sec) mysql> CREATE TABLE `waehrungen` ( -> `bezeichnung` varchar(50) NOT NULL default '', -> `land` varchar(50) NOT NULL default '', -> `iso` varchar(3) NOT NULL default '', -> `waehrung` varchar(100) NOT NULL default '', -> PRIMARY KEY (`bezeichnung`) -> ) ENGINE=MyISAM DEFAULT CHARSET=utf8; Query OK, 0 rows affected (0.05 sec) mysql> mysql> INSERT INTO `waehrungen` VALUES ('afghanistan', 'Afghanistan', 'AFA', -> 'Afghani'); Query OK, 1 row affected (0.02 sec) mysql> INSERT INTO `waehrungen` VALUES ('albania', 'Albanien', 'ALL', 'Lek'); Query OK, 1 row affected (0.00 sec) mysql> INSERT INTO `waehrungen` VALUES ('egypt', 'Ägypten', 'EGP', 'Ägyptisches '> Pfund'); Query OK, 1 row affected (0.00 sec) mysql> INSERT INTO `waehrungen` VALUES ('estonia', 'Estland', 'EEK', 'Estnische '> Krone'); Query OK, 1 row affected (0.00 sec) mysql> INSERT INTO `waehrungen` VALUES ('ethiopia', 'Äthiopien', 'ETB', 'Birr'); Query OK, 1 row affected (0.00 sec) mysql> INSERT INTO `waehrungen` VALUES ('euro', 'Europäische Union', 'EUR', 'Euro'); Query OK, 1 row affected (0.00 sec) mysql> INSERT INTO `waehrungen` VALUES ('fiji', 'Fidschi', 'FJD', 'Fidschi Dollar'); Query OK, 1 row affected (0.00 sec) mysql> select land, waehrung from waehrungen where land like '%x%' order by land; Empty set (0.00 sec) mysql> select land, waehrung from waehrungen where land like '%ä%' order by land -> ; +-------------------+----------+ | land | waehrung | +-------------------+----------+ | Europäische Union | Euro | +-------------------+----------+ 1 row in set (0.00 sec)
[27 Jul 2005 1:09]
Markus Popp
Here's what I get in the windows terminal: mysql> CREATE TABLE `waehrungen` ( -> `bezeichnung` varchar(50) NOT NULL default '', -> `land` varchar(50) NOT NULL default '', -> `iso` varchar(3) NOT NULL default '', -> `waehrung` varchar(100) NOT NULL default '', -> PRIMARY KEY (`bezeichnung`) -> ) ENGINE=MyISAM DEFAULT CHARSET=utf8; Query OK, 0 rows affected (0.02 sec) mysql> insert into waehrungen values ('turkey', 'Türkei', 'TRN', 'Türkische Lira '); Query OK, 1 row affected, 2 warnings (0.02 sec) mysql> select land from waehrungen where land like '%ü%'; Empty set (0.00 sec) mysql> show variables like '%character%'; +--------------------------+--------------------------+ | Variable_name | Value | +--------------------------+--------------------------+ | character_set_client | utf8 | | character_set_connection | utf8 | | character_set_database | utf8 | | character_set_results | utf8 | | character_set_server | utf8 | | character_set_system | utf8 | | character_sets_dir | D:\mysql\share\charsets/ | +--------------------------+--------------------------+ 7 rows in set (0.00 sec) mysql>
[27 Jul 2005 1:17]
Markus Popp
The umlaut and everything behind it has been completely ignored, when I did the insertion: mysql> select * from waehrungen; +-------------+------+-----+----------+ | bezeichnung | land | iso | waehrung | +-------------+------+-----+----------+ | turkey | T | TRN | T | +-------------+------+-----+----------+ 1 row in set (0.00 sec) mysql>
[27 Jul 2005 1:22]
MySQL Verification Team
Try to use set names cp1251: c:\mysql\bin>mysql -uroot --default_character_set=utf8 test Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 5 to server version: 5.0.11-beta-nt Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> set names cp1251; Query OK, 0 rows affected (0.00 sec) mysql> CREATE TABLE `waehrungen` ( -> `bezeichnung` varchar(50) NOT NULL default '', -> `land` varchar(50) NOT NULL default '', -> `iso` varchar(3) NOT NULL default '', -> `waehrung` varchar(100) NOT NULL default '', -> PRIMARY KEY (`bezeichnung`) -> ) ENGINE=MyISAM DEFAULT CHARSET=utf8; Query OK, 0 rows affected (0.06 sec) mysql> insert into waehrungen values ('turkey', -> 'Türkei', 'TRN', 'TürkischeLira'); Query OK, 1 row affected (0.00 sec) mysql> select land from waehrungen where land like '%ü%'; +--------+ | land | +--------+ | Türkei | +--------+ 1 row in set (0.00 sec)
[27 Jul 2005 1:29]
Markus Popp
This works the same way with me.
[27 Jul 2005 1:40]
MySQL Verification Team
I assume set names cp1251 worked for you or I am wrong?
[27 Jul 2005 1:49]
Markus Popp
That's correct.
[27 Jul 2005 2:02]
Markus Popp
Why is this not a bug?
[9 Sep 2005 20:54]
Renich Bon Ciric
I have a problem just like this one. The diference is that I use php5's mysqli extension. I need my server to accept UTF-8 permanently over the php connector. When I try this: SELECT * FROM `Dirección General`; It gives me a "Table 'directorio.Dirección General' doesn't exist" error How can I change this?