3 ms·
Back when rolling your own application level protocol on top of TCP was common (as opposed to using http, zeromq, etc) I frequently used file/record/group/unit
by pavon 3y ago
Back when rolling your own application level protocol on top of TCP was common (as opposed to using http, zeromq, etc) I frequently used file/record/group/unit separators for delimiters, and considered them an underrated gem, especially for plain-text data where they were prohibited to occur in the message body so you didn't have to escape them (still good to scan and reject messages containing them). As a modern example they (and most other ASCII control characters) are disallowed in json strings.
- gkbrk 3y agoYou can put control characters in JSON strings, you just need to escape them.
- pavon 3y agoThe way I read the json standard, the only way to include control characters is to encode them as hex. For example BEL can be encoded as "\u0007", but escaping it by using a backslash followed by a literal BEL character is not allowed. So literal control characters should never be in json text.
- lsaferite 3y agoThis makes me wonder if the Escape control character (\u001B) would work in a JSON string. Time to go test things out. :)
- paulddraper 3y agoMLLP (Minimal Lower Layer Protocol) -- used extensively to transmit HL7 in health systems -- uses file separators to delimit messages. OB vertical tab <content> 1C file separator 0D carriage return I wrote one of the most popular translators for MLLP, which converts it to HTTP [1]. --- P.S. Ironically, HL7 messages have something literally called a "field separator" but don't use the field separator character, usually they use vertical bar. [1] https://github.com/rivethealth/mllp-http https://github.com/rivethealth/mllp-http