问题描述
我试图弄清楚我应该对各种类型的数据使用哪种排序规则.我将要存储的内容的100%是用户提交的.
I'm trying to figure out what collation I should be using for various types of data. 100% of the content I will be storing is user-submitted.
我的理解是,我应该使用UTF-8通用CI(不区分大小写),而不是UTF-8 Binary.但是,我找不到UTF-8通用CI和UTF-8 Unicode CI之间的明显区别.
My understanding is that I should be using UTF-8 General CI (Case-Insensitive) instead of UTF-8 Binary. However, I can't find a clear a distinction between UTF-8 General CI and UTF-8 Unicode CI.
- 我应该在UTF-8 General或UTF-8 Unicode CI列中存储用户提交的内容吗?
- UTF-8 Binary适用于什么类型的数据?
推荐答案
通常, utf8_general_ci 比 utf8_unicode_ci 快,但正确性较低.
In general, utf8_general_ci is faster than utf8_unicode_ci, but less correct.
这是区别:
引用自: http://dev.mysql.com/doc/refman /5.0/zh-CN/charset-unicode-sets.html
有关更多详细说明,请阅读MySQL论坛中的以下文章: http://forums.mysql.com/read.php?103,187048,188748
For more detailed explanation, please read the following post from MySQL forums:http://forums.mysql.com/read.php?103,187048,188748
对于utf8_bin: utf8_general_ci 和 utf8_unicode_ci 均执行不区分大小写的比较.相反, utf8_bin区分大小写(除其他差异外),因为它会比较字符的二进制值.
As for utf8_bin:Both utf8_general_ci and utf8_unicode_ci perform case-insensitive comparison. In constrast, utf8_bin is case-sensitive (among other differences), because it compares the binary values of the characters.
这篇关于UTF-8:一般?斌吗Unicode?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!