Bug #521 CP1250 charset bug
Submitted: 28 May 2003 0:56 Modified: 28 May 2003 4:50
Reporter: Pavel Kanzelsberger Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:4.1 OS:Any (All)
Assigned to: CPU Architecture:Any

[28 May 2003 0:56] Pavel Kanzelsberger
Description:
There's a bug in cp1250 character set, czech collation. While inserting and/or sorting data from db, numbers 3 and 4 seems to have same weight. I think those two numbers are mapped to same unicode...

How to repeat:
Create table with column of type char(3), add Unique key to this column. Now try to insert 'H03' and then 'H04' to this column, while trying to insert second one you'll get error "duplicate key entry"
[28 May 2003 1:22] Pavel Kanzelsberger
DROP TABLE IF EXISTS `bubu` ;

CREATE TABLE bubu (

  nazov varchar(8) NOT NULL default ''

) TYPE=MyISAM CHARSET=cp1250 COLLATE=cp1250_czech_ci;

INSERT INTO bubu VALUES ('I');

INSERT INTO bubu VALUES ('2');

INSERT INTO bubu VALUES ('3');

INSERT INTO bubu VALUES ('4');

INSERT INTO bubu VALUES ('5');

INSERT INTO bubu VALUES ('CH');

INSERT INTO bubu VALUES ('H');

INSERT INTO bubu VALUES ('A');

INSERT INTO bubu VALUES ('B');

INSERT INTO bubu VALUES ('C');

INSERT INTO bubu VALUES ('D');

SELECT * FROM bubu ORDER BY nazov ASC

SELECT * FROM bubu ORDER BY nazov DESC
[28 May 2003 1:34] Pavel Kanzelsberger
Here's how to fix the problem:

File: strings/ctype-win1250ch.c

Line: 289
Structure: static uchar NEAR _sort_order_win1250ch1[]
Original: 0x92, 0x93, 0x94, 0x95, 0x95, 0x97, 0x98, 0x99,
Patch: 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99,
[28 May 2003 4:50] Alexander Barkov
Thank you for your bug report. This issue has been fixed in the latest
development tree for that product. You can find more information about
accessing our development trees at 
    http://www.mysql.com/doc/en/Installing_source_tree.html

Thanks for reporting and for fix! The change suggested by you 
has been made in the latest development tree.