我在我的应用中显示这些字符时遇到问题。例如,在我的MySQL数据库中,我有一行文本“Šauauaiaia”,在我的应用程序中,在文本字段中,它显示为“null”。如果我将“Š”替换为其他“标准”字符,那么一切都还可以。
例如“Ćća”显示为“?? a”。
有人可以告诉我,为了解决这个问题,我应该在哪里进行更改?
这是我给出的PHP脚本。
<?php
$host = "xxx.xxx.xxx"; // host of MySQL server
$user = "xxx"; // MySQL user
$pwd = "xxx"; // MySQL user's password
$db = "xxx"; // database name
// Create connection
$con = mysqli_connect($host, $user, $pwd, $db);
header('Content-Type: text/html; charset=UTF-8');
// Check connection
if(mysqli_connect_errno($con)) {
die("Failed to connect to MySQL: " . mysqli_connect_error());
}
$sql = "Select id as iii,kategorija as ooo,naslov as nnn,datum as ddd,urlN as uuu from vijesti where datum!='". $_POST["ustanova"]."' order by iii desc limit 0,20";
$result = mysqli_query($con, $sql);
// an array to save the application data
$rows = array();
// iterate to query result and add every rows into array
while($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) {
$rows[] = $row;
}
// close the database connection
mysqli_close($con);
// echo the application data in json format
echo json_encode($rows);
提前致谢!
答案 0 :(得分:0)
Reading signs like č ć đ š ž from MySql database
我相信你的问题在这里得到解答。似乎是问题的副本; android不应该让它变得特别。