[wp-trac] [WordPress Trac] #40560: REST API: Unicode characters are escaped in the response

WordPress Trac noreply at wordpress.org
Thu Feb 22 16:32:49 UTC 2018


#40560: REST API: Unicode characters are escaped in the response
--------------------------+-----------------------
 Reporter:  rilwis        |       Owner:
     Type:  defect (bug)  |      Status:  closed
 Priority:  normal        |   Milestone:
Component:  REST API      |     Version:  4.7
 Severity:  normal        |  Resolution:  invalid
 Keywords:  close         |     Focuses:  rest-api
--------------------------+-----------------------
Changes (by jnylen0):

 * status:  reopened => closed
 * resolution:   => invalid
 * severity:  major => normal


Comment:

 @hwgehring sorry, but your claim that "Unicode-escaped text is only valid
 JSON in certain exceptional cases" is a misreading of the RFC you quoted.

 From https://tools.ietf.org/html/rfc8259#section-7:

 > Any character may be escaped.  If the character is in the Basic
 Multilingual Plane (U+0000 through U+FFFF), then it may be represented as
 a six-character sequence ... Alternatively, there are two-character
 sequence escape representations of some popular characters.

 So even the string `"\u0048\u0065\u006c\u006c\u006f"` is perfectly valid
 JSON.  Proof:
 https://jsonlint.com/?json=%22\u0048\u0065\u006c\u006c\u006f%22

 Again, if this is an issue for you, it means the library or technique you
 are using to parse JSON is incorrect.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/40560#comment:8>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list