note 71244 deleted from function.json-encode by felipe
| From: | felipe@php.net | Date: | Mon, 10 Dec 2007 17:31:24 +0000 |
| Subject: | note 71244 deleted from function.json-encode by felipe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-133170@lists.php.net to get a copy of this message | ||
Note Submitter: Andrea Giammarchi
----
// fixes unconverted chars in range 00-1f
function json_real_encode($obj){
$range = array_merge(range(0, 7), array(11), range(14, 31));
return str_replace(
array_map(create_function('&$i', 'return chr($i);'), $range),
array_map(create_function('&$i', 'return $i ?
"\\u00".sprintf("%02x", $i) : "\\u0000";'), $range),
json_encode($obj)
);
}