哪种MySQL排序规则最适合接受所有unicode字符?

编程入门 行业动态 更新时间:2024-10-27 01:35:14
本文介绍了哪种MySQL排序规则最适合接受所有unicode字符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我们的专栏目前整理为latin1_swedish_ci,显然,特殊的Unicode字符已被删除.我们希望能够接受诸如U+272A ✪,U+2764 ❤之类的字符(请参见此Wikipedia文章)等.我倾向于utf8_unicode_ci,此排序规则可以处理这些字符和其他字符吗?我不在乎速度,因为此列不是索引.

Our column is currently collated to latin1_swedish_ci and special unicode characters are, obviously, getting stripped out. We want to be able to accept chars such as U+272A ✪, U+2764 ❤, (see this wikipedia article) etc. I'm leaning towards utf8_unicode_ci, would this collation handle these and other characters? I don't care about speed as this column isn't an index.

MySQL版本:5.5.28-1

MySQL Version: 5.5.28-1

推荐答案

排序规则是您最少的担心,您需要考虑的是字符集用于列/表/数据库.排序规则(控制数据比较和排序的规则)只是推论.

The collation is the least of your worries, what you need to think about is the character set for the column/table/database. The collation (rules governing how data is compared and sorted) is just a corollary of that.

MySQL支持几种Unicode字符集,其中最有趣的是utf8和utf8mb4. utf8支持 BMP 中的Unicode字符,即所有Unicode的子集.从MySQL 5.5.3开始提供的utf8mb4支持Unicode的 all .

MySQL supports several Unicode character sets, utf8 and utf8mb4 being the most interesting. utf8 supports Unicode characters in the BMP, i.e. a subset of all of Unicode. utf8mb4, available since MySQL 5.5.3, supports all of Unicode.

与任何Unicode编码一起使用的归类很可能是xxx_general_ci或xxx_unicode_ci.前者是一种独立于语言的常规排序和比较算法,后者是一种更完整与语言无关的算法,支持更多的Unicode功能(例如,将ß"和"ss"视为等效),但是因此也比较慢.

The collation to be used with any of the Unicode encodings is most likely xxx_general_ci or xxx_unicode_ci. The former is a general sorting and comparison algorithm independent of language, the latter is a more complete language independent algorithm supporting more Unicode features (e.g. treating "ß" and "ss" as equivalent), but is therefore also slower.

请参见 dev.mysql/doc/refman/5.5/zh-CN/charset-unicode-sets.html .

更多推荐

哪种MySQL排序规则最适合接受所有unicode字符?

本文发布于:2023-11-29 18:17:24,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1647211.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:最适合   哪种   字符   规则   MySQL

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!