MySQL不将ı视为i?

问题描述 投票:0回答:1

我在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
mysql unicode encoding collation
1个回答
0
投票

here所述,它指出utf8_unicode_ci支持:

诸如扩展的映射;也就是说,当一个字符比较等于其他字符的组合时。

因此,当您使用一次转换查询归类时:

select * from .. where a = b COLLATE utf8_unicode_ci;

即使您在表上使用其他排序规则,也可以更改字符映射。

提示来自https://stackoverflow.com/a/2607164/916000

© www.soinside.com 2019 - 2024. All rights reserved.