5 ms·
Not if you're passing binary data
by jcheng 1y ago
Not if you're passing binary data
- woodruffw 1y agoEven beyond that: the ASCII delimiter control codes are perfectly valid UTF-8 (despite not being printable), so using them for in-band signaling is a recipe for pain on arbitrary UTF-8 data.
- mananaysiempre 1y agoIf you know your data is UTF-8, then bytes 0xFE and 0xFF are guaranteed to be free. Strictly speaking, 0xC0, 0xC1, and 0xF5 through 0xFD also are, but the two top values are free even if you are very lax and allow overlong encodings as well as codepoints up to 2³² − 1.
- woodruffw 1y agoI think it would probably be better to invest in a proper framing design than trying to poke holes in UTF-8. (This is true regardless of UTF-8 -- in-band encodings are almost always brittle!)