Req #53946 [Com]: add json_encode option for not escaping unnecessary character
| From: | irker@php.net | Date: | Tue, 19 Jul 2011 16:18:06 +0000 |
| Subject: | Req #53946 [Com]: add json_encode option for not escaping unnecessary character | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-162008@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
Comment 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:
Fragment from rfc4627 ( http://www.ietf.org/rfc/rfc4627.txt )
"All Unicode characters may be placed within the
quotation marks EXCEPT for the characters that MUST BE escaped:
quotation mark, reverse solidus, and the control characters (U+0000
through U+001F).
Any character MAY BE escaped."
Previous Comments:
------------------------------------------------------------------------
[2011-07-19 12:14:14] irker@php.net
The given option is especially necessary, when json is used in ajax responses. The
size of a line decreases approximately twice.
I have added a patch which the minimum changes in a code adds support given
parameter.
This parameter doesn't demand UTF8 to UTF16 encoding. But encoding validate utf8
line, therefore I hadn't touch it for BC.
------------------------------------------------------------------------
[2011-07-19 12:02:55] irker@php.net
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
------------------------------------------------------------------------
[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?
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=53946
--
Edit this bug report at https://bugs.php.net/bug.php?id=53946&edit=1