logoalt Hacker News

dgantoday at 10:34 AM4 repliesview on HN

I am just wondering how it is good idea for a sever to insert some characters into user's input. If a collegue were to propose this, i d laugh in his face

It's just sp hacky i cant belive it's a real life's solution


Replies

jagged-chiseltoday at 10:44 AM

“Insert characters”?

Consider converting the original text (maintaining the author’s original line wrapping and indentation) to base64. Has anything been “inserted” into the text? I would suggest not. It has been encoded.

Now consider an encoding that leaves most of the text readable, translates some things based on a line length limit, and some other things based on transport limitations (e.g. passing through 7-bit systems.) As long as one follows the correct decoding rules, the original will remain intact - nothing “inserted.” The problem is someone just knowledgeable enough to be aware that email is human readable but not aware of the proper decoding has attempted to “clean up” the email for sharing.

show 1 reply
flexagoontoday at 10:41 AM

When you post a comment on HN, the server inserts HTML tags into your input. Isn't that essentially the same thing?

show 1 reply
direwolf20today at 12:11 PM

It's called escaping, and almost every protocol has it. HN must convert the & symbol to & for displaying in HTML. Many wire protocols like SATA or Ethernet must insert a 1 after a certain number of consecutive 0s to maintain electrical balance. Don't remember which ones — don't quote me that it's SATA and Ethernet.

show 1 reply
layer8today at 11:59 AM

Just wait until you learn what mess UTF-8 will turn your characters into. ;)