可能有重音敏感和不区分大小写的utf8排序规则在mysql中? [英] is possible to have accent sensitive and case insensitive utf8 collation in mysql?
问题描述
如何在mysql中执行区分重音但不区分大小写的utf8搜索? utf8_bin区分大小写,而utf8_general_ci不区分重音.
How can I perform accent-sensitive but case-insensitive utf8 search in mysql? Utf8_bin is case sensitive, and utf8_general_ci is accent insensitive.
推荐答案
There doesn't seem to be one because case sensitivity is tough to do in Unicode.
有一个utf8_general_cs
排序规则,但它似乎是实验性的,并且根据此错误报告,与使用LIKE时没有达到预期的效果.
There is a utf8_general_cs
collation but it seems to be experimental, and according to this bug report, doesn't do what it's expected to when using LIKE.
如果您的数据仅包含西方变音符号(即ISO-8859-1中包含的变音符号),则您可以将搜索操作归类到latin1_german2_ci
或使用它创建单独的搜索列(该特定列根据此页面,排序规则对重音敏感; latin1_general_ci
也可能是,我现在不知道并且无法测试).
If your data consists of western umlauts only (ie. umlauts that are included in ISO-8859-1), you might be able to collate your search operation to latin1_german2_ci
or create a separate search column with it (that specific collation is accent sensitive according to this page; latin1_general_ci
might be as well, I don't know and can't test right now).
这篇关于可能有重音敏感和不区分大小写的utf8排序规则在mysql中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!