note 105386 deleted from function.json-encode by cmb
| From: | cmb@php.net | Date: | Sun, 04 Nov 2018 09:59:02 +0000 |
| Subject: | note 105386 deleted from function.json-encode by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-209602@lists.php.net to get a copy of this message | ||
Note Submitter: Tibor Halter
----
json_encode($binary) problem: it results in an empty string "" without error.
You will see this happening when encoding binary images, for example.
Use utf8_encode first.
<?php
$data = 'éáÃúűóüöäÃÃ';
$json = json_encode( utf8_encode($data) );
// [..]
$data = utf8_decode( json_decode($json) );
?>