DU Community Help
Related: About this forumSomething very strange is going on with backslashes in DU mail and board messages
I noticed this first with DU mail.
When you have a contraction - any contraction - in the title of mail you're about to send, and you preview it, the preview will show a backslash inserted in front to the apostrophe.
That backslash will disappear when the mail is sent.
I started posting a message for this forum about this, and discovered that if a backslash is in the text of a message - I typed haven't with a backslash in front of the apostrophe to show what I meant - that backslash will disappear when it's previewed (from the text that was typed as well as the preview) and will not show up when it's posted.
I tried posting 4 backslashes together. Previewed it, and 2 disappeared. Previewed it again, and another one of the backslashes disappeared. And they also disappeared not just from the preview, but from the text I'd just typed. So I tried posting to the board without previewing (that OP has been self-deleted) and half the backslashes had vanished in what appeared on the board.
Btw, previewing a board post with a contraction in the title does not make a backslash appear before the apostrophe. That happens only with Mail previews.
EarlG
(22,514 posts)for security purposes. If we didn't do that, certain characters could be used to insert code strings into input fields which could allow someone to hack the site.
In this case you're using backslashes as an example, which have an additional use. This is a pretty rough explanation, but basically backslashes are used in coding to "escape" characters that come after them, so they're read as text, not code. For example, if you wanted to write something like this:
echo "A double quote mark looks like this " which I think is pretty cool."
... the code would break because when it reached the second double quote it would treat it as the end of the string rather than a text character. In order to avoid a problem like that, you'd use a backslash in front of the double quote to indicate that that it's a text character and not part of the code, like so:
echo "A double quote mark looks like this \" which I think is pretty cool."
Which would generate this:
A double quote mark looks like this " which I think is pretty cool.
The reason you were seeing four, then two, then one backslashes is because when you use four:
\\\\
...backslashes 2 and 4 are being "escaped" by backslashes 1 and 3. Backslashes 1 and 3 will be recognized as code and stripped from the subject line as disallowed characters. However, backslashes 2 and 4 will be recognized as text. That leaves you with:
\\
When you hit preview again, the same thing happens -- backslash 1 "escapes" backslash 2, backslash 1 is stripped from the code, and backslash 2 is allowed as text, which leaves you with:
\
(And by the way, the only reason these backslashes are showing up in my post is because I'm using the HTML code for them and not previewing, otherwise most of them would be stripped out.)
Hope that all makes sense.