To escape a code point that is not in the Basic Multilingual Plane, the character is represented as a twelve-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"
.
ECMA-404: The JSON Data Interchange Format
I believe that there is no need to encode this character at all, so it could be represented directly as ""
. However, should one wish to encode it, it must, per spec, be encoded as "\uD834\uDD1E"
, not (as would seem reasonable) as "\u1d11e"
. Why is this?