mysql - MySQL 中的 utf8_general_ci 和 utf8_unicode_ci 有什么区别?

标签 mysql character-encoding

一段时间以来,我一直使用 phpMyAdmin 来管理本地 MySQL 数据库。我开始接受的一件事是我的数据库的正确字符集。我已经确定 UTF-8 是兼容性最好的(因为我的 XHTML 模板作为 UTF-8 使用)但让我感到困惑的一件事是我在 phpMyAdmin 界面中看到的 UTF-8 的各种选项?

我隔离的两个是:

  • utf8_general_ci
  • utf8_unicode_ci

所以我的问题是:MySQL 中 utf8generalunicode 变体有什么区别? (我了解到 ci 是不区分大小写的简写)

在这件事上任何帮助将不胜感激。

最佳答案

来自MySQL manual on Unicode Character Sets :

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.

参见 further information and examples 的引用页.

关于mysql - MySQL 中的 utf8_general_ci 和 utf8_unicode_ci 有什么区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3337863/

相关文章:

php - 如何获取MYSQL相关搜索结果

Python:如何强制输出 iso-8859-1 文件?

xml - 传输编码对 XML 编码和字符引用的影响

java - 我可以使用 MySQL Connector/J 执行以分号分隔的多个查询吗?

java - hibernate 保存实体

python - 在 Python 中使用非 ASCII 字符编码邮件主题 (SMTP)

php - ' "turns out as\' 和\"

c++ - 区域设置和编码(终端)有什么区别

mysql - 如何在 codeigniter 中连接表?

mysql - 使用 mysql 返回字段和所有行的总和