Comic Discussion > QUESTIONABLE CONTENT

WCT: August 24-28, 2009

<< < (21/35) > >>

workingrobbie:

--- Quote from: akronnick on 27 Aug 2009, 00:42 ---Also why is Dora wearing Jeph's hat?

--- End quote ---

Who cares? I think she looks HOT in that hat  :laugh:

akronnick:

--- Quote from: Random832 on 27 Aug 2009, 03:48 ---
--- Quote from: akronnick on 27 Aug 2009, 00:42 ---Also, and I'm totally not trying to point out a typo, because God knows I always type perfectly, but how did a "\" end up in the word "don\'t" in the news post? How is that even possible, I mean physically?

--- End quote ---

There are lots of programming languages in which the apostrophe is a special character, and sometimes code can get a bit aggressive about it. \' or even \\\' is surprisingly common.

--- End quote ---

Ah, that makes sense, software is to blame.

Mr_Rose:
I would just like to say that today's Specials are awesome.
That is all.

bicostp:

--- Quote from: akronnick on 27 Aug 2009, 00:42 ---Also, and I'm totally not trying to point out a typo, because God knows I always type perfectly, but how did a "\" end up in the word "don\'t" in the news post? How is that even possible, I mean physically?

--- End quote ---

Backslashes tell JavaScript to treat apostrophes and quotes as text, rather than parse them as part of the code. Otherwise it would cut off the string at the first quote it comes across and then go "whublargh what's all this I don\'t understand?!" when it finds more non-code text.

http://www.htmlgoodies.com/beyond/javascript/article.php/3470891

DoubleJ:

--- Quote from: akronnick ---Ah, that makes sense, software is to blame.
--- End quote ---
PHP especially. It's one of the languages where a single quote means something (the beginning or end of a piece of text) so if the text includes one it has to be "escaped" so the interpreter or compiler knows to ignore it. In PHP you do that by putting a backslash before it: ' becomes \' when you have to feed it to the code.

The reason PHP sucks in this regard is that, in addition to providing a function to do this for you, the installation also can be set to do it automatically. If the installation changes things can get wacky.

First, the function turns ' into \' like it's supposed to.

Then, the automatic bit sees a backslash, which must itself be escaped, followed by an apostrophe that must be escaped. The backslash becomes a double backslash and the apostrophe becomes a backslash-apostophe again: \\\'

If that gets fed through another piece of software it may do even more escaping if things are set up wrong.

RSS feeds tend to suffer the same problem with ampersands. To encode a character you can use a special name (in some cases) that HTML assigns to it. To put an é on a page you can type &eacute; to make it appear. Since the ampersand has a special meaning in HTML like a backslash does in PHP, it has to be its own reference: An & all by itself is written &amp;

Some RSS feed generators get overambitious and double-encode things. So you type "&eacute;" to get an é, and the software encodes it again giving you &amp;eacute; which makes your feed look stupid.

Remember, kids. Computers make our lives easier. Whether we like it or not.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version