Edit report at https://bugs.php.net/bug.php?id=63152&edit=1
ID: 63152 Updated by: ni...@php.net Reported by: staff at newsocialife dot com -Summary: Json is going stupid +Summary: json_encode does not work on binary strings Status: Not a bug Type: Bug Package: JSON related Operating System: Ubuntu PHP Version: 5.3.17 Block user comment: N Private report: N New Comment: Also, would be nice if you could provide a more meaningful title next time :) Btw, if you want to encode binary data as JSON (or basically anything else) you should first base64_encode it. Previous Comments: ------------------------------------------------------------------------ [2012-09-24 15:24:07] ras...@php.net JSON as per RFC-4626 cannot encode arbitrary binary data. Everything you pass to json_encode() must be valid Unicode. json_last_error() would have told you this. ------------------------------------------------------------------------ [2012-09-24 15:14:39] staff at newsocialife dot com Description: ------------ So, I have an array witch doesn't encode right in json... ( look the example script... ) Test script: --------------- $a = Array ( "password" => "SeRjQRVUglkeMâ°â°P9L7NsjKXOY", //it's encrypted with a custom encryption system "id" => 0 ); echo json_encode($a); Expected result: ---------------- {"password":"SeRjQRVUglkeMâ°â°P9L7NsjKXOY","id":0} Actual result: -------------- {"password":null,"id":0} ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=63152&edit=1