function json_encode_unicode($data) {
if (defined('JSON_UNESCAPED_UNICODE')) {
return json_encode($data, JSON_UNESCAPED_UNICODE);
}
return preg_replace_callback('/(?<!\\\\)\\\\u([0-9a-f]{4})/i',
function ($m) {
$d = pack("H*", $m[1]);
$r = mb_convert_encoding($d, "UTF8", "UTF-16BE");
return $r!=="?" && $r!=="" ? $r : $m[0];
}, json_encode($data)
);
}
php
<iframe width="100%" height="398" src="http://snipet.teknotit.com/index.php?embed=55a487dbe1b96" type="text/html"></iframe>
Texte seul - Permalink - Snippet public posté le 14/07/2015