Reputation: 681
I'm trying to query my database to get some results in Chinese and Japanese languages as follows:
$str = '日本';
$get_character = mysql_fetch_array (mysql_query("SELECT id FROM `mytable` WHERE ch = '$str'"));
print $get_character[0];
The problem is it returns me nothing. For testing purpose I've changed 日本
in database to test
and I do get the right id. What's the problem?
Thanks!
Upvotes: 0
Views: 2271
Reputation: 321638
Probably you need to set your connection to UTF-8 (assuming that's what you're using):
mysql_query('SET NAMES "utf8"');
Upvotes: 2
Reputation: 46913
The collation (or maybe encoding) is probably set incorrectly on the field, likely to English or something similar so characters in other languages get mutilated when you try to insert them.
Upvotes: 2