我在MySQL 5.7.27中有一个用户表,带有utf8mb4_unicode_ci
排序规则。
不幸的是,例如,ı没有像i那样被穿线,以下查询找不到Yılmaz
select id from users where name='Yilmaz';
我对诸如ä
和a
的其他变音符号没有问题。例如,两个查询给出的结果完全相同。
select id from users where name='Märie';
select id from users where name='Marie';
我不能简单地将ı
替换为i
并进行搜索,因为这样我将找不到名称为Yılmaz
的用户。
我必须使用其他排序规则来支持所有的umlaute吗?
以下是有关Unicode字母的更多信息:
code | glyph |decimal | html | description
U+0131 | ı |305 |ı | Latin Small Letter dotless I
U+0069 | i |105 |- | Latin Small Letter I
如here所述,它指出utf8_unicode_ci
支持:
诸如扩展的映射;也就是说,当一个字符比较等于其他字符的组合时。
因此,当您使用一次转换查询归类时:
select * from .. where a = b COLLATE utf8_unicode_ci;
即使您在表上使用其他排序规则,也可以更改字符映射。