MYSQL 5.1.61排序utf8中的中欧语言 [英] MYSQL 5.1.61 sorting for Central European languages in utf8

查看:172
本文介绍了MYSQL 5.1.61排序utf8中的中欧语言的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个排序MYSQL结果的问题。

I have a problem with sorting MYSQL result..

SELECT * FROM table WHERE something ORDER BY column ASC

设置为utf8_unicode_ci ..

column is set to utf8_unicode_ci..

因此,我首先得到以波斯尼亚语开头的行,然后是其后的其他行。

As a result I first get rows which have column starting with Bosnian letters and then the others after that..

šablabl
šeblabla
čeblabla
aaaa
bbaa
bbb
ccc

MYSQL版本为5.1.61

MYSQL version is 5.1.61

推荐答案

Bgi是对的。您需要使用适当的归类。不幸的是,MySQL还没有一个中欧unicode排序规则。 MariaDb ,MySQL分支由MySQL的创建者维护,

Bgi is right. You need to use an appropriate collation. Unfortunately, MySQL doesn't have a Central European unicode collation yet. MariaDb, the MySQL fork being maintained by MySQL's creators, does.

因此,您可以将文本从utf8转换为latin2,序列。例如

So you can convert your text from utf8 to latin2 and then order with a Central European collating sequence. For example.

  SELECT * 
    FROM tab
ORDER BY CONVERT(text USING latin2) COLLATE latin2_croatian_ci

查看此小提琴: http://sqlfiddle.com/#!2/c8dd4/1/0

这篇关于MYSQL 5.1.61排序utf8中的中欧语言的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆