difficulty passing Japanese characters(UTF-8) via

2019-03-05 18:21发布

Having problems returning a list of Japanese terms from an MSSql database as JSON. If I return them as a bunch of list items all is ok, but I can not seem to get json encode to work for me. Any pointers much appreciated.

$prefs = array();
while($row = mssql_fetch_array($result))
{
$prefs[] =  mb_convert_encoding($row["Pref"] , "UTF-8", "SHIFT-JIS") ; 
    //echo "<li>" . mb_convert_encoding($row["Pref"] , "UTF-8", "SHIFT-JIS") . "</li>";
}

 echo json_encode($prefs);

标签: php json utf-8
1条回答
一纸荒年 Trace。
2楼-- · 2019-03-05 19:08

\u611b\u77e5\u770c = 愛知県 (Aichi Prefecture)

\u611b\u5a9b\u770c = 愛媛県 (Ehime Prefecture)

Both are correct Japanese Prefecture name. So string conversion part has no problem.

The perp is hiding in the later phase.

查看更多
登录 后发表回答