寻找不区分大小写的 MySQL 排序规则,其中“a”是!= ”ä”
我正在寻找 UTF8 的 MySQL 排序规则,它不区分大小写,并区分“a”和“ä”(或者更一般地说,区分变音/重音字符及其“纯”形式)。 utf8_general_ci
执行前者,utf8_bin
执行后者,bot none 执行两者。如果没有这样的排序规则,我该怎么做才能在 WHERE
子句中尽可能接近?
I'm looking for a MySQL collation for UTF8 which is case insensitive and distinguishes between "a" and "ä" (or more generally, between umlauted / accented characters and their "pure" form). utf8_general_ci
does the former, utf8_bin
the latter, bot none does both. If there is no such collation, what can I do to get as close as possible in a WHERE
clause?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我的建议是使用
utf8_bin
并在 WHERE 子句中强制比较的两边都为大写或小写。My recommendation would be to use
utf8_bin
and in your WHERE clause, force both sides of your comparison to upper or lower case.它在这里使用
utf8_german2_ci
作为排序规则工作正常:It works fine here with
utf8_german2_ci
as collation:我像这样检查了
utf8_bin
I checked
utf8_bin
like this您可以尝试
utf8_swedish_ci
,它不区分大小写,并区分a和ä(但将例如ü视为< em>y)。排序规则与语言相关,并且德语似乎在 MySQL 中没有自己的排序规则。 (我看了你的个人资料,上面写着你是德国人。)
You could try
utf8_swedish_ci
, it's both case insensitive and distinguishes between a and ä (but treats e.g. ü like y).Collations are language-dependent, and it seems German doesn't have its own collation in MySQL. (I had a look at your profile, which says you're German.)