When using echo json_encode($array, JSON_UNESCAPED_UNICODE);
I get the this error
Warning: json_encode() expects exactly 1 parameter, 2 given
Your php version might be too low:
http://php.net/manual/en/function.json-encode.php
string json_encode ( mixed $value [, int $options = 0 ] )
5.3.0 The options parameter was added
See patch at http://code.google.com/p/apns-php/issues/detail?id=22 which allows the same functionality on PHP 5.2.
Basically run something like this:
foreach ($array as &$val) {
$val = preg_replace_callback('/\\\\u([0-9a-f]{4})/i',
function($matches) {
return mb_convert_encoding(pack('H*', $matches[1]), 'UTF-8', 'UTF-16');
}, $val);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With