Any way to return PHP `json_encode` with encode UTF-8 and not Unicode? -
any way return php json_encode encode utf-8 , not unicode?
$arr=array('a'=>'á'); echo json_encode($arr); mb_internal_encoding('utf-8');and $arr=array_map('utf8_encode',$arr); not fix it.
result: {"a":"\u00e1"}
expected result: {"a":"á"}
{"a":"\u00e1"} , {"a":"á"} different ways write same json document; json decoder decode unicode escape.
in php 5.4+, php's json_encode have json_unescaped_unicode option plain output. on older php versions, can roll out own json encoder not encode non-ascii characters, or use pear's json encoder , remove line 349 433.
Comments
Post a Comment