Re:JSON Schema Store
by unilynx on Monday August 21, 2023 @06:26AM
(#37207542)
JSON and XML both support UTF-8. Neither supports embedding arbitrary binary data directly, especially if that data is not valid in your current character set
[ Parent
| on HN ]
You wanted to send zero byte. This is how you send zero byte. You are making unrelated claims now that has nothing to do with your original claim.
You can't safely send zero bytes over XML even with UTF-8 encoding. Not in practice:
echo '<zero>�</zero>' | xmllint -
-:1: parser error : xmlParseCharRef: invalid xmlChar value 0
<zero>�</zero>
^
printf '<?xml version="1.0" encoding="utf-8"?><zero>\0</zero>' | xmllint -
-:1: parser error : Premature end of data in tag zero line 1
<?xml version="1.0" encoding="utf-8"?><zero>
^
And not in theory: https://www.w3.org/TR/2006/REC-xml11-20060816/#sec-well-form... Character Range
[2] Char ::= [#x1-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF] /* any Unicode character, excluding the surrogate blocks, FFFE, and FFFF. */
[2a] RestrictedChar ::= [#x1-#x8] | [#xB-#xC] | [#xE-#x1F] | [#x7F-#x84] | [#x86-#x9F]