bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#24784: 26.0.50; JSON strings with utf-16 escape codes


From: Philipp Stephani
Subject: bug#24784: 26.0.50; JSON strings with utf-16 escape codes
Date: Mon, 24 Oct 2016 19:57:19 +0000



Helmut Eller <eller.helmut@gmail.com> schrieb am Mo., 24. Okt. 2016 um 20:58 Uhr:

json-read-from-string doesn't parse strings correctly if the the \u
syntax is used to write UTF-16 surrogates:

 (equal (json-read-from-string "\"\\uD834\\uDD1E\"") "\"\U0001D11E\"")
 => nil

The correct result t.  To quote RFC 7159[*]:

   To escape an extended character that is not in the Basic Multilingual
   Plane, the character is represented as a 12-character sequence,
   encoding the UTF-16 surrogate pair.  So, for example, a string
   containing only the G clef character (U+1D11E) may be represented as
   "\uD834\uDD1E".

[*] https://tools.ietf.org/html/rfc7159#section-7

Thanks for reporting, I've attached a patch. 

Attachment: 0001-Fix-encoding-of-JSON-surrogate-pairs.txt
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]