Reputation: 11
I'm working with an aboriginal indigenous dictionary. Special characters include ŋ, ä, ḏ, ḻ, ṉ, ṯ
Characters display in a browser but php MySQL select isn't working: a search for ‘a’ finds a and ä, but ä finds nothing. ŋ doesn’t work. Underlined chars same behaviour... d finds both, ḏ nothing.
The specific queries have this code…
mysql_query ("set character_set_results='utf8'"); //this got it to display the correct characters
mysql_query("set names 'utf8"); // this didn’t seem to do anything tried it after forum searching
$list = mysql_query("SELECT * FROM database WHERE word LIKE '$some_string' ");
All column settings in the database are varchar() CHARACTER SET utf8 DEFAULT NULL, The Database itself is DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
MySQL 5.0
I tried inserting COLLATE UTF8_BIN after the query (as suggested by others), but then the search returns nothing and I get an error (mysql_fetch_array() expects parameter 1 to be resource, boolean given) At my wit's end here, any suggestions much appreciated.
Upvotes: 1
Views: 462
Reputation: 11
Thanks to everyone who's looked at this, especially hex494D49 for spotting the typo in my code (so "SET NAMES 'utf8'" worked which fixed part of my problem). Seems the charset utf8_bin successfully differentiates all characters (including upper-lowercase, but I can live with that). Cheers all
Upvotes: 0