-1

I have in my MySQL (Server version: 5.6.14 & Server charset: UTF-8 Unicode (utf8)) database a table with some names (written in Dutch) like:

  • Afrika
  • Antarctica
  • Azië
  • Europa
  • Noord-Amerika
  • Oceanië
  • Zuid-Amerika
  • Angola
  • Argentinië
  • Aruba
  • Australië
  • België
  • Brazilië
  • Burma

Using PHP I have written a search method that tries to find names in the database based on user input. When an user searches for 'Azie' it should find 'Azië'.

Is there a PHP or MySQL function to solve this issue? Because the search method is searching in more tables than only this location table I don't want to use extra tables or columns with alternative notations. This will make it more complex.

I set the mysqli charset with $mysqli->set_charset("utf8") also the HTML document is utf8.

Pinquin
  • 9
  • 3

1 Answers1

1

Did you try actually use it?
If so, and doesn't work - what is collation on the table and column?
If it's utf_general_ci (which is default for utf8 charset) and still doesn't work - try to alter it to utf8_unicode_ci. Here you can see how it can be done: How to change the default collation of a table? If table/field charset is not utf8 - you have to change it first.

To see actual collations you can run SHOW CREATE TABLE table_name query

Community
  • 1
  • 1
Your Common Sense
  • 156,878
  • 40
  • 214
  • 345
  • Thank you for your answer. To answer your question(s), yes I did actually tried it. My table and colums are utf8_general_ci. I was chancing my database, connection, tables and columns to utf8_unicode_ci when I realized that I collect all the data into objects, for comparing search words, to minimize the number of sql queries. So the question I asked is wrong and not the problem at all. -- This question can be deleted because it is not an existing problem. – Pinquin Nov 22 '13 at 10:30
  • better use a database for this. there is nothing wrong with using database. it's intended for it – Your Common Sense Nov 22 '13 at 10:30
  • Even if the requests are on the fly while typing for the suggestion box it has to appear? – Pinquin Nov 22 '13 at 10:36