#46325 [Opn->Bgs]: Bug with json_encode and json_decode function

From: Date: Mon, 20 Oct 2008 15:54:49 +0000
Subject: #46325 [Opn->Bgs]: Bug with json_encode and json_decode function
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-129877@lists.php.net to get a copy of this message
ID: 46325 Updated by: lbarnaud@php.net Reported By: nihil dot kaos at gmail dot com -Status: Open +Status: Bogus Bug Type: JSON related Operating System: Win XP SP3 PHP Version: 5.2.6 New Comment: Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php json functions accepts only valid UTF-8 characters. ASCII characters are UTF-8 compatible, but I guess '°' is not. Previous Comments: ------------------------------------------------------------------------ [2008-10-17 08:38:36] nihil dot kaos at gmail dot com Description: ------------ The json_encode and the json_decode functions bug with the degree character ( '°' ). Reproduce code: --------------- header("content-type: text"); $test = array(); $test['data'] = "test1°test2"; echo json_encode($test) . "\r\n"; print_r(json_decode('{"data":"test1°test2"}')); Expected result: ---------------- {"data":"test1°test2"} stdClass Object ( [data] => test1°test2 ) Actual result: -------------- {"data":"test1"} ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=46325&edit=1

« previous php.bugs (#129877) next »