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

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -