Charset solution for Json_encode for PHP 5.3.3
Since JSON_UNESCAPED_UNICODE does not work in PHP 5.3.3, so we used this method and it works.
$data = array( 'text' => 'Päiväkampanjat' ); $json_encode = json_encode($data); var_dump($json_encode); // text: "P\u00e4iv\u00e4kampanjat" $unescaped_data = preg_replace_callback('/\\\\u(\w{4})/', function ($matches) { return html_entity_decode('&#x' . $matches[1] . ';', ENT_COMPAT, 'UTF-8'); }, $json_encode); var_dump($unescaped); // text is unescaped -> Päiväkampanjat
source share