我正在使用MYSQL数据库,其中将数据存储在排序规则中:utf16le_general_ci。我这样做是为了在数据库中支持我的区域语言,并且能够成功以我的区域语言(GUJARATI)存储数据。
但是当我使用PHP(版本7+)读取数据并以JSON格式回显数据时,会得到这种结果:
[
{
"content_id":"1",
"cat_id_FK":"1",
"content_data":"??????????? ? ????? ??????? ??."
},
{
"content_id":"2",
"cat_id_FK":"1",
"content_data":"???? ?? ??? ?? 80% ????? ???? ??? ? ??? ??, ???? ??? ?????? ?? ??????,?????????? ??? ?????\r\n??????? ?? ??? ??????? ???? ??? ??? ??."
},
{
"content_id":"3",
"cat_id_FK":"1",
"content_data":"?????????? ??????? ????????? ???? ???? ???? ? ???????????."
},
{
"content_id":"4",
"cat_id_FK":"1",
"content_data":"??????????? ??? ???? ?????? ?????? ???? ???? ????? ?? ???????? ?? ??? ??."
},
{
"content_id":"5",
"cat_id_FK":"1",
"content_data":"??? ????? ????? ???????? ?? ????? ????? ??? ??????? ? ??????????? ?? ????? ???? ????."
},
{
"content_id":"6",
"cat_id_FK":"1",
"content_data":"??????????? ???? ?? ??? ??? ??? ? ????? ???."
}
]
我的代码:-
header('Content-Type:application/json;charset=utf-8');
//header('Content-Type:application/json;charset=utf16le_general_ci');
include 'init.php';
global $connect;
$query = "SELECT * FROM gsrahasyacontent WHERE cat_id_FK=1";
$queryResult = mysqli_query($connect, $query);
while ($row = mysqli_fetch_assoc($queryResult)) {
$array[] = $row;
}
echo json_encode($array, JSON_UNESCAPED_UNICODE);
//print json_encode($array, JSON_UNESCAPED_UNICODE);
->我尝试将字符集从utf-8更改为utf16le_general_ci,但这没有用。
->我也使用了print而不是json,但仍然得到了相同的结果。
答案 0 :(得分:1)
尝试这个PictureBox