Req #53946 [PATCH]: add json_encode option for not escaping unnecessary character

From: Date: Tue, 19 Jul 2011 16:02:55 +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-162005@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.patch
Revision:   1311091375
URL:        https://bugs.php.net/patch-display.php?bug=53946&patch=json_unescaped_unicode.patch&revision=1311091375


Previous Comments:
------------------------------------------------------------------------
[2011-07-19 12:02:24] irker@php.net

The following patch has been added/updated:

Patch Name: bug53946.phpt
Revision:   1311091344
URL:        https://bugs.php.net/patch-display.php?bug=53946&patch=bug53946.phpt&revision=1311091344

------------------------------------------------------------------------
[2011-07-19 12:01:33] irker@php.net

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

------------------------------------------------------------------------
[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


Thread (15 messages)

« previous php.bugs (#162005) next »