0
$obj = [{"name":"Hình Ảnh","url":"images"}];
$str = json_encode($obj);

result:

[{"name":"H\u00ecnh \u1ea2nh","url":"hinh_anh"}]

Why?

Why $str not is:

[{"name":"Hình Ảnh","url":"images"}];
Rizier123
  • 58,877
  • 16
  • 101
  • 156

1 Answers1

2

Add your file this code

header('Content-type: text/html; charset=UTF-8') ;

and change

$str = json_encode($obj, JSON_UNESCAPED_UNICODE);
Akim
  • 136
  • 1
  • 9
  • I see, I was do it, but this result with: json_encode($obj, JSON_UNESCAPED_UNICODE); ==> json_encode() expects parameter 2 to be long, string given in note: – Nguyễn Văn Tiến May 09 '15 at 10:51