Edit report at http://bugs.php.net/bug.php?id=53946&edit=1
ID: 53946
Comment by: trolzen at gmail dot com
Reported by: christian dot pernot at pingroom dot net
Summary: add json_encode option for not escaping unnecessary
character
Status: Assigned
Type: Feature/Change Request
Package: JSON related
PHP Version: 5.3.5
Assigned To: scottmac
Block user comment: N
Private report: N
New Comment:
Maybe it's worth mentioning in manual that json_encode converts national
characters into strings like \uxxxx and that there is no way to change
this behaviour yet?
Previous Comments:
------------------------------------------------------------------------
[2011-02-10 20:42:42] [email protected]
Seems reasonable to add.
------------------------------------------------------------------------
[2011-02-07 10:22:03] christian dot pernot at pingroom dot net
Description:
------------
It would be great to have a option for json_encode which make possible
to keep non-ascii character "as such" in strings (and not \uxxxx), which
is the case for example with mozilla's JSON.stringify.
json.org states string can have
"any-Unicode-character-except-"-or-\-or-control-character"
Test script:
---------------
$str = "test accentué";
echo json_encode($str);
gives
"test accentu\u00e9"
Expected result:
----------------
"test accentué"
Actual result:
--------------
"test accentu\u00e9"
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=53946&edit=1