Bug #77274 [Opn->Nab]: json_encode white option JSON_UNESCAPED_UNICODE not work
| From: | cmb@php.net | Date: | Mon, 10 Dec 2018 11:37:45 +0000 |
| Subject: | Bug #77274 [Opn->Nab]: json_encode white option JSON_UNESCAPED_UNICODE not work | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-218360@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=77274&edit=1
ID: 77274
Updated by: cmb@php.net
Reported by: mwd_3330410 at 163 dot com
Summary: json_encode white option JSON_UNESCAPED_UNICODE not
work
-Status: Open
+Status: Not a bug
Type: Bug
-Package: *Unicode Issues
+Package: JSON related
Operating System: All
PHP Version: 7.1.25
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
> this is a test:my name is ABCÃÃÃÃ
This would be invalid JSON, since according to RFC 7159[1]:
| 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).
[1] <https://tools.ietf.org/html/rfc7159#section-7>
Previous Comments:
------------------------------------------------------------------------
[2018-12-10 03:47:52] mwd_3330410 at 163 dot com
Description:
------------
---
From manual page: https://php.net/function.json-encode
---
When the string contains special chars like ''ï¼Hexadecimal character
<0x14>ï¼ï¼use the function json_encode($str, JSON_UNESCAPED_UNICODE) ï¼the result
is \u0014 (PHP version 5.4 ~ 7.0).I don't know what the char is.Please check it and resove.
Test script:
---------------
echo json_encode('this is a test:my name is ABCÃÃÃÃ',
JSON_UNESCAPED_UNICODE);
Expected result:
----------------
this is a test:my name is ABCÃÃÃÃ
Actual result:
--------------
this is a test:my name is ABCÃ\u0014Ã\u0014Ã\u0014Ã
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=77274&edit=1