Bug #77274 [Opn->Nab]: json_encode white option JSON_UNESCAPED_UNICODE not work

From: 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

« previous php.bugs (#218360) next »