我在我的应用程序中显示这些字符时遇到问题。例如,在我的 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);
提前致谢!