json-read-from-string doesn't parse strings correctly if the the \u
syntax is used to write UTF-16 surrogates:
=C2=A0(equal (json-read-from-string "\"\\uD834\\uDD1E\""=
;) "\"\U0001D11E\"")
=C2=A0=3D> nil
The correct result t.=C2=A0 To quote RFC 7159[*]:
=C2=A0 =C2=A0To escape an extended character that is not in the Basic Multi=
lingual
=C2=A0 =C2=A0Plane, the character is represented as a 12-character sequence=
,
=C2=A0 =C2=A0encoding the UTF-16 surrogate pair.=C2=A0 So, for example, a s=
tring
=C2=A0 =C2=A0containing only the G clef character (U+1D11E) may be represen=
ted as
=C2=A0 =C2=A0"\uD834\uDD1E".
[*] https://tools.ietf.org/html/rfc=
7159#section-7
Thanks for reporting, I've attached a patch.=C2=A0
--001a114e2a8e5983f2053fa1cd1f--
--001a114e2a8e5983f6053fa1cd21
Content-Type: text/plain; charset=US-ASCII;
name="0001-Fix-encoding-of-JSON-surrogate-pairs.txt"
Content-Disposition: attachment;
filename="0001-Fix-encoding-of-JSON-surrogate-pairs.txt"
Content-Transfer-Encoding: base64
Content-ID: <157f844beafc1921ba11>
X-Attachment-Id: 157f844beafc1921ba11
RnJvbSA2YzYzMGJkNWIwMDEyNDNkNmI3MTE1MzgwMDg4OTA5YTdhMTgwZGRiIE1vbiBTZXAgMTcg
MDA6MDA6MDAgMjAwMQpGcm9tOiBQaGlsaXBwIFN0ZXBoYW5pIDxwaHN0QGdvb2dsZS5jb20+CkRh
dGU6IE1vbiwgMjQgT2N0IDIwMTYgMjE6NTQ6NTEgKzAyMDAKU3ViamVjdDogW1BBVENIXSBGaXgg
ZW5jb2Rpbmcgb2YgSlNPTiBzdXJyb2dhdGUgcGFpcnMKCkpTT04gcmVxdWlyZXMgdGhhdCBzdWNo
IHBhaXJzIGJlIHRyZWF0ZWQgYXMgVVRGLTE2IHN1cnJvZ2F0ZSBwYWlycywgbm90CmluZGl2aWR1
YWwgY29kZSBwb2ludHM7IGNmLiBCdWcgIzI0Nzg0LgoKKiBsaXNwL2pzb24uZWwgKGp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