开发者

Looking for case insensitive MySQL collation where "a" != "ä"

I'm looking for a MySQL collation for UTF8 whic开发者_开发知识库h 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?


My recommendation would be to use utf8_bin and in your WHERE clause, force both sides of your comparison to upper or lower case.


It works fine here with utf8_german2_ci as collation:

SELECT * FROM tablename WHERE fieldname LIKE "würz%" COLLATE utf8_german2_ci


I checked utf8_bin like this

CREATE TABLE tmp2 (utf8_bin VARCHAR(20) CHARACTER SET utf8 COLLATE utf8_bin);
INSERT INTO tmp2 VALUES ('nói');

select * from tmp2 where utf8_bin='noi';


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.)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜