views:

30

answers:

1

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);
A: 

\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.

kmugitani
Thanks - all sorted. Actually ended up being a cross domain issue and like you said the Japanese was fine.
Chin