问题
Possible Duplicate:
UTF-8 all the way through
I want to write a web application in android and use php to connect with mysql.this app is in Persian. when I connect to mysql only with php, I can see data in Persian(therfore my connection to mysql is true) but when i use this php in android app to connect to mysql, I don't get data in Persian. please help.
回答1:
your table must charset UTF-8,
before insert & before select you must use this query immediately after connect:
SET CHARACTER SET utf8
for example:
$m_Handle = mysqli_connect('loaclhost',DATABASEUSERNAME,DATABASEPASSWORD,DATABASENAME)
or die ( mysqli_error($m_Handle) );
$sSQL= 'SET CHARACTER SET utf8';
mysqli_query($m_Handle,$sSQL)
or die ('Can\'t charset in DataBase');
i'm Persian and test it more times...
来源:https://stackoverflow.com/questions/13568323/show-another-characters-instead-of-persian-characters-by-connect-to-mysql-in-and