本文介绍了什么是德语最好的MySQL排序规则的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在用德语建立一个网站,所以我会使用像ä,ü,ß
解决方案

作为字符集,如果可以,绝对是UTF-8。



作为排序规则 - 对于具有特殊字符的语言来说,这有点令人讨厌。有各种类型的归类。他们都可以存储所有Umlaut和其他人物,但他们在比较中如何对待Umlauts有所不同,即是否

  u =ü 

为true或false;和排序(在排列顺序中的Umlauts位于字母中)。



为了简短说明,您最好的选择是



utf8_unicode_ci



它允许不区分大小写的搜索;它将ß作为 ss 并使用DIN-1排序。可悲的是,像所有的非二进制Unicode排序规则一样,它对待 u =ü这是一个可怕的麻烦,因为搜索Muller也将返回Müller。您将不得不通过设置实时的Umlaut感知整理来解决这个问题。



utf8_bin



此排序规则没有 u =ü问题,但仅区分大小写的搜索可能。



不完全确定使用二进制排序规则是否有其他副作用?我询问了有关的问题。






可以很好地了解各种排序规则及其日常使用带来的后果。



是有关可用排序规则的总体概述在mySQL中。


I am building a web site in German language, So I will be using characters like ä, ü, ß etc., So what are your recommendations?

解决方案

As the character set, if you can, definitely UTF-8.

As the collation - that's a bit nasty for languages with special characters. There are various types of collations. They can all store all Umlauts and other characters, but they differ in how they treat Umlauts in comparisons, i.e. whether

u = ü 

is true or false; and in sorting (where in the alphabets the Umlauts are located in the sorting order).

To make a long story short, your best bet is either

utf8_unicode_ci

It allows case insensitive searches; It treats ß as ss and uses DIN-1 sorting. Sadly, like all non-binary Unicode collations, it treats u = ü which is a terrible nuisance because a search for "Muller" will also return "Müller". You will have to work around that by setting a Umlaut-aware collation in real time.

or utf8_bin

This collation does not have the u = ü problem but only case sensitive searches are possible.

I'm not entirely sure whether there are any other side effects to using the binary collation; I asked a question about that here.


This mySQL manual page gives a good overview over the various collations and the consequences they bring in everyday use.

Here is a general overview on available collations in mySQL.

这篇关于什么是德语最好的MySQL排序规则的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-21 13:49