I kinda like MIME's choice. XML's CDATA seems rather pointless to me, by contrast (having such a strange syntax that still requires one to escape a 3-char delimiter but whose existance is "justified" because you don't have to escape a 1-char delimiter).
For MIME, you pick some short, random string (from a restricted set of characters). If that string is in the data to be sent, then look at the character that follows it and append some other random character on the end of your random string. Repeat until you have a string that does not appear anywhere in your data. Then output the delimiter before and after the data. It requires that you scan the data to be sent once before you send it but is robust in the face of character translations in your pipe (important in an e-mail protocol where trailing spaces might not be preserved, for example) and doesn't require any transformation of the data to be sent.
- tye
In reply to Re^2: How to end socket file transfer without closing socket (MIME)
by tye
in thread How to end socket file transfer without closing socket
by redss
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |