I have a MySQL database encoded in UTF-8 that contains English and Hungarian text.
I’m working on a search function and the results are acceptable except one thing:
The search on strings containing “á”, “é”, “í”, “ó”, “ö”, “ő”, “ú”, “ü”, “ű” results all the occurances of them but also shows the results for “a”, “e”, “i”, “o”, “u”. This way the search won’t be precise because it results a lot of unwanted records, for example, we get all the “bar” for “bár” (which are obviously not the same).
I made the search by LIKE in a simply way (although it has many variations for whole-words-search-only or for exact word order, the base is the same):
SELECT * FROM table WHERE coloumn LIKE 'word'
How can I escape the unwanted results? I’m not an SQL expert and have never made a search like this, so I need a little help…
Thanks!
Not really sure this will work, but you can try using
to do a direct compare and
to check if value1 is a substring of value2.
MySQL will not use indexes for them so you should probably use those alongside of your normal
WHERE.