note 105742 added to function.json-encode
| From: | anonymous at gmail dot com | Date: | Mon, 12 Sep 2011 00:53:22 +0000 |
| Subject: | note 105742 added to function.json-encode | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-183100@lists.php.net to get a copy of this message | ||
Since PHP5.3 does not yet have JSON_UNESCAPED_UNICODE I had to find a way of leaving the unicode
characters un-escaped in the json:
<?php
array_walk_recursive($array, function(&$item, $key) {
if(is_string($item)) {
$item = htmlentities($item);
}
});
$json = json_encode($array);
$rson = html_entity_decode($rson);
?>
----
Server IP: 69.147.83.197
Probable Submitter: 111.69.28.194
----
Manual Page -- http://www.php.net/manual/en/function.json-encode.php
Edit -- https://master.php.net/note/edit/105742
Del: integrated -- https://master.php.net/note/delete/105742/integrated
Del: useless -- https://master.php.net/note/delete/105742/useless
Del: bad code -- https://master.php.net/note/delete/105742/bad+code
Del: spam -- https://master.php.net/note/delete/105742/spam
Del: non-english -- https://master.php.net/note/delete/105742/non-english
Del: in docs -- https://master.php.net/note/delete/105742/in+docs
Del: other reasons-- https://master.php.net/note/delete/105742
Reject -- https://master.php.net/note/reject/105742
Search -- https://master.php.net/manage/user-notes.php