Closed mikee47 closed 3 months ago
Done some checking an according to the JSON spec escape support is strictly limited to text. \xnn
is not available, only \u+nnnn
for unicode escapes. So we'd need to use our own encoding (base64) to store binary data in JSON.
I'd better revise the Format::Json
stuff as well. Sigh.
The
StringPool
storage currently stores string items as a sequence of NUL-terminated C-strings, identified by aStringId
type which represents the starting offset for the value.The main disadvantage of this is that it cannot accommodate binary data. This PR updates the pool to use counted strings instead. It adds
CountedString
to manage instances, with the length encoded in a prefix of one or two bytes.A quick test shows that
JsonStreamingParser
can only handle a limited set of single-character escapes, such as\n
, so requires updating to handle escapes such as\0
or\xfe
.