Bug #9607 compare accented letters with non-accented
Submitted: 4 Apr 2005 11:53 Modified: 11 Apr 2005 19:58
Reporter: Jaroslav Serdula Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.1.10a OS:Linux (debian)
Assigned to: Alexander Barkov CPU Architecture:Any

[4 Apr 2005 11:53] Jaroslav Serdula
Description:
Hi,

Problem is when I compare accented letters with non-accented.
“Select statements;” works nice but “select * from table where the same statements;” doesn’t work.
See example :-)

PS: some combinations work (‘a’ = ‘á’)
	

jaro

How to repeat:
mysql> select * from table1;
+------+
| coll |
+------+
| č    |
+------+
1 rows in set (0.00 sec)

mysql> select 'č'='c';
+---------+
| 'č'='c' |
+---------+
|       1 |
+---------+
1 row in set (0.00 sec)

mysql> select * from table1 where coll='c';
Empty set (0.00 sec)
[4 Apr 2005 18:36] MySQL Verification Team
mysql> select 'č'='c';
+--------------+
| 'č'='c' |
+--------------+
|            0 |
+--------------+
1 row in set (0.07 sec)

mysql> select version();
+------------------+
| version()        |
+------------------+
| 4.1.11-debug-log |
+------------------+
1 row in set (0.03 sec)
[5 Apr 2005 5:46] Jaroslav Serdula
Sorry but html-form changed accented letters to &#NUMBER; ...
Please try attached file test.sql (utf8)
[5 Apr 2005 5:48] Jaroslav Serdula
to avoid html-form problem use attached file to repeat problem

Attachment: test.sql (application/octet-stream, text), 959 bytes.

[5 Apr 2005 19:25] MySQL Verification Team
You don't showed what collate are you used in the create table,
there is collation that the accented letter is handled like the similar
one without accent. try for example:

miguel@hegel:~/dbs/4.1$ bin/mysql -uroot test
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8 to server version: 4.1.11-debug-log

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> create table uaccent (col char(1)) character set=utf8, collate=utf8_bin;
Query OK, 0 rows affected (0.01 sec)

mysql> insert into uaccent values ('á');
Query OK, 1 row affected (0.00 sec)

mysql> select * from uaccent where col = 'a';
Empty set (0.00 sec)

mysql> select * from uaccent where col = 'á';
+------+
| col  |
+------+
| á    |
+------+
1 row in set (0.00 sec)

mysql>
[6 Apr 2005 6:32] Jaroslav Serdula
mysql> show create table test;
+-------+---------------------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table                                                                                                                           |
+-------+----------------------------------------------------------------------------------------------------------------------------------------+
| test  | CREATE TABLE "test" (
  "coll" char(1) collate utf8_slovak_ci default NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_slovak_ci |
+-------+----------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

mysql>
[11 Apr 2005 19:58] Alexander Barkov
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.mysql.com/documentation/ and the instructions on
how to report a bug at http://bugs.mysql.com/how-to-report.php

Additional info:

Jaroslav. When you say "SET NAMES utf8", collation is set
to utf8_general_ci. In this collation 

letters 'č' and 'c' are equal. However, when
you do select from column, comparison is done according to Slovak  collation,
which treats 'č' as a separate letter between 'c' and 'd'.
This is not a bug, everything works as expected.