Show another characters instead of persian characters by connect to mysql in android [duplicate]

烈酒焚心 提交于 2019-12-11 08:41:09

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!