在Android应用程序中检索时,阿拉伯语文本在网页上显示为آسٔاÙ

时间:2015-09-12 20:10:00

标签: php mysql text character arabic

我创建了一个mysql数据库。我已将字符设置为utf-8并将其设置为utf8_general_ci。在数据库表中,文本没问题。但是当我在网页上查看时,它看起来像“أسٓأ。当我将此代码检索到我的Android应用程序时,我遇到了同样的问题。

php code(index.php)

$con = mysqli_connect("mysql.hostinger.ph", "db_name", "passwrd", "u242667358_test");
if (mysqli_connect_errno()) {
    echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
mysqli_set_charset($con, "utf8");

php code(index.php)

require_once('db.php');

$query = "SELECT * FROM BalochiNames ORDER BY RAND() LIMIT 1";   

mysqli_query($con, $query); 

$result = mysqli_query($con, $query);
while ($row = mysqli_fetch_array($result)) {
    echo stripslashes($row['BalochiName']);
}
mysqli_close($con);

0 个答案:

没有答案