php - MySQL find umlaute by "oe", "ae", "ue" -
i'm trying build mysql search query. like
fine, client wants inputs "oe" find "ö", "ae" find "ä" , "ue" find "ü" it's common in germany.
tried using regexp
after replacing every occurence of "oe" (oe|ö)
regexp
strict , doesn't match (for instance) "é" "e".
there way make like
match "oe|ue|ae" or maybe other way haven't though of?
thanks,
thomas
at character sets , collations supported mysql can spot 2 german collations:
- latin1_german1_ci
- latin1_german2_ci
it seems latin1_german2_ci 1 want, expects latin1:
latin1_german2_ci
(phone-book) rules:
- Ä = ae
- Ö = oe
- Ü = ue
- ß = ss
if table/column not using it, can force such collation in query itself, e.g.:
mysql> select _latin1'oe' collate latin1_german2_ci ='ö' are_equal; +-----------+ | are_equal | +-----------+ | 1 | +-----------+ 1 row in set (0.00 sec)
if application using latin1 should trick. otherwise, have no idea :)
disclaimer: know nothing german. there may language uses similar rules.
Comments
Post a Comment