MySQL Forums
Forum List  »  German

Re: Datenbank im utf8 format nach cp1251 sortieren
Posted by: Peter Gulutzan
Date: August 09, 2009 02:00PM

Ich habe diese Sortierung versucht:

mysql> create table t (s1 char(2) character set utf8);
Query OK, 0 rows affected (0.06 sec)

mysql> insert into t values ('б'),('а'),('в');
Query OK, 3 rows affected (0.01 sec)
Records: 3 Duplicates: 0
Warnings: 0

mysql> select s1,hex(s1) from t order by cast(s1 as char character set cp1251);
+------+---------+
| s1 | hex(s1) |
+------+---------+
| а | D0B0 |
| б | D0B1 |
| в | D0B2 |
+------+---------+
3 rows in set (0.00 sec)

... also, ganz korrekt nacht kyrillischen Regeln. Noch einfacher,

mysql> select s1,hex(s1) from t order by s1;
+------+---------+
| s1 | hex(s1) |
+------+---------+
| а | D0B0 |
| б | D0B1 |
| в | D0B2 |
+------+---------+
3 rows in set (0.00 sec)

... geht auch gut.

Peter Gulutzan
Sun Microsystems / MySQL

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: Datenbank im utf8 format nach cp1251 sortieren
2247
August 09, 2009 02:00PM


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.