我正在检索印度语的数据,并且输出为??????????????????????????
注意 : - 我在 php 脚本中使用了这 2 行
header('Content-type: text/plain; charset=utf-8');
mysqli_set_charset($conn,'utf-8');
我还在数据库和表中使用了utf8_general_ci编码。
我的 PHP 脚本是
<?php
require 'init.php';
header('Content-type: text/plain; charset=utf-8');
mysqli_set_charset($conn,'utf-8');
$table = $_GET['table_name'];
$sql = "SELECT * FROM ".$table;
$response = array();
$result = mysqli_query($conn,$sql);
if(mysqli_num_rows($result)>0) {
while($row = mysqli_fetch_array($result)) {
array_push($response, array('id'=>$row['id'],'text'=>$row['text']));
}
echo json_encode($response);
} else {
echo "error";
}
mysqli_close($conn);
?>
您可以查看链接 http://www.sharefb.com/statusApp/readStatus.php?table_name=gujrati_attitude
使用 mysqli_set_charset( $db, 'utf8');
在标题中添加此元标记并尝试
<META HTTP-EQUIV="Content-Type" CONTENT="text/html"; charset="utf-8" />
注意:如果结果显示类似????,则您可能需要通过启用以下选项来安装外部语言支持工具,
控制面板 -> 区域和语言选项 -> 语言 -> 安装复杂脚本和从右到左语言(包括泰语)的文件。
请参阅utf8字符问题中的"问号";我看到的不是我存储的
如果您仍有问题,请提供
显示创建表
要插入
的文本示例 选择错误数据样本的十六进制 (...) (?
=3F
)