gpt4 book ai didi

mysql - UTF-8:通用?垃圾桶?统一码?

转载 作者:行者123 更新时间:2023-11-30 23:23:49 24 4
gpt4 key购买 nike

我正在尝试弄清楚我应该对各种类型的数据使用哪种排序规则。我将存储的 100% 的内容都是用户提交的。

我的理解是我应该使用 UTF-8 通用 CI(不区分大小写)而不是 UTF-8 二进制。但是,我找不到 UTF-8 通用 CI 和 UTF-8 Unicode CI 之间的明确区别。

  1. 我应该将用户提交的内容存储在 UTF-8 General 还是 UTF-8 Unicode CI 列中?
  2. UTF-8 Binary 适用于哪些类型的数据?

最佳答案

一般来说,utf8_general_ciutf8_unicode_ci 快,但不太正确。

这是区别:

For any Unicode character set, operations performed using the _general_ci collation are faster than those for the _unicode_ci collation. For example, comparisons for the utf8_general_ci collation are faster, but slightly less correct, than comparisons for utf8_unicode_ci. The reason for this is that utf8_unicode_ci supports mappings such as expansions; that is, when one character compares as equal to combinations of other characters. For example, in German and some other languages “ß” is equal to “ss”. utf8_unicode_ci also supports contractions and ignorable characters. utf8_general_ci is a legacy collation that does not support expansions, contractions, or ignorable characters. It can make only one-to-one comparisons between characters.

引用自: http://dev.mysql.com/doc/refman/5.0/en/charset-unicode-sets.html

更详细的解释,请阅读MySQL论坛的以下帖子: http://forums.mysql.com/read.php?103,187048,188748

至于utf8_bin:utf8_general_ciutf8_unicode_ci 都执行不区分大小写的比较。相比之下,utf8_bin 区分大小写(除其他差异外),因为它比较字符的二进制值。

关于mysql - UTF-8:通用?垃圾桶?统一码?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14294387/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com