Req #53946 [PATCH]: add json_encode option for not escaping unnecessary character
| From: | irker@php.net | Date: | Tue, 19 Jul 2011 16:01:33 +0000 |
| Subject: | Req #53946 [PATCH]: add json_encode option for not escaping unnecessary character | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-162003@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=53946&edit=1
ID: 53946
Patch added by: irker@php.net
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:
The following patch has been added/updated:
Patch Name: json_unescaped_unicode
Revision: 1311091293
URL: https://bugs.php.net/patch-display.php?bug=53946&patch=json_unescaped_unicode&revision=1311091293
Previous Comments:
------------------------------------------------------------------------
[2011-03-25 17:59:42] trolzen at gmail dot com
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?
------------------------------------------------------------------------
[2011-02-10 20:42:42] scottmac@php.net
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 https://bugs.php.net/bug.php?id=53946&edit=1