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

WordPress Trac noreply at wordpress.org
Tue Apr 25 15:00:26 UTC 2017


#40560: REST API: Unicode characters are escaped in the response
--------------------------+------------------------------
 Reporter:  rilwis        |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  REST API      |     Version:  trunk
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+------------------------------

Comment (by subrataemfluence):

 To my understanding this is reasonable enough! Specially when we deal with
 characters like double quote ("), forward slash (/), single quote (') etc.
 If such characters are not escaped they might give rise to unwanted
 situation when parsing.

 For example I have a post with the following content:

 '''<p>It was raining when I reached the "Amritsar ISBT" at around 9:30am
 </p>'''

 When JSON-fied by WP REST API it becomes

 {{{#!php
 "content":{"rendered":"<p>It was raining when I reached the
 “Amritsar ISBT” at around 9:30am...<\/p>"}
 }}}

 which is reasonable because unescaped double quotes will have wrong
 interpretation to WP parser.

 So I think it is OK to have unicode characters to get escaped upfront.

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


More information about the wp-trac mailing list