Collation and sort order of uft8_swedish_ci
Posted by: Make Virtanen
Date: February 15, 2010 12:14PM

I have a simple table that I have defined as utf8_swedish_ci and the column "title" should be sorted accordingly. Here's the hex dump:
select hex(title) from songs where title like "p%" order by title;
+------------------------------------+
| hex(title) |
+------------------------------------+
| 50C3844956494E20C396494E |
| 50C3844956494E20C396494E |
| 50415252415356414C4F54 |
| 504944C384204B49494E4E49 |
| 5049454E455354C38420504954C384454E |
| 5049494B4B494C414E4B4141 |
| 50494D45C3845354C3842056414C4F4F4E |
+------------------------------------+
and the corresponding text:

mysql> select title from songs where title like "p%" order by title;
+-------------------+
| title |
+-------------------+
| PÄIVIN ÖIN |
| PÄIVIN ÖIN |
| PARRASVALOT |
| PIDÄ KIINNI |
| PIENESTÄ PITÄEN |
| PIIKKILANKAA |
| PIMEÄSTÄ VALOON |
+-------------------+

This is incorrect as row (3) should be the first one and rows(1,2) should be the last ones. The utf8 hex codes (C384) are correct and the collation has been defined as it should but the result is sadly the incorrect one.

And, yes, I have run the "SET NAMES utf8" when both before writing to the database and before reading from it.

regards
-MV-

Options: ReplyQuote


Subject
Views
Written By
Posted
Collation and sort order of uft8_swedish_ci
4102
February 15, 2010 12:14PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.