PHP json_encode json_decode UTF-8 PHP json_encode json_decode UTF-8 json json

PHP json_encode json_decode UTF-8


json utf8 encode and decode:

json_encode($data, JSON_UNESCAPED_UNICODE)json_decode($json, false, 512, JSON_UNESCAPED_UNICODE)

force utf8 might be helpfull too: http://pastebin.com/2XKqYU49


This is an encoding issue. It looks like at some point, the data gets represented as ISO-8859-1.

Every part of your process needs to be UTF-8 encoded.

  • The database connection

  • The database tables

  • Your PHP file (if you are using special characters inside that file as shown in your example above)

  • The content-type headers that you output


  header('Content-Type: application/json; charset=utf-8');