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');
If your source-file is already utf8 then drop the utf8_* functions. php5 is storing strings as array of byte.
you should add a meta tag for encoding within the html AND you should add an http header which sets the transferencoding to utf-8.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
and in php
<?php
header('Content-Type: text/html; charset=utf-8');
Try sending the UTF-8 Charset header:
<?php header ('Content-type: text/html; charset=utf-8'); ?>
And the HTML meta:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />