&less than

Friday, July 13th, 2007 03:59 pm
afuna: Cat under a blanket. Text: "Cats are just little people with Fur and Fangs" (Default)
[personal profile] afuna
When it's not followed by a letter or number, &lt can be interpreted by browsers in the same way as &lt;. That is, < and < should both show up as less than symbols (check the source if you want to confirm). So if you leave out the semi-colon and just type &lt, it will still show up as a < as long as you don't do anything funny like follow it with a non-whitespace character (or will it work with certain other punctuation marks as well?)

It shows up this way on normal webpages, but not in comment notifications viewed in Gmail.

I can't tell whether it's a Gmail thing or an HTML cleaner thing. (Actually, for once I don't really care enough to test further. I'm just amused because I spent a few hours testing, only to have [livejournal.com profile] aveleh forward me a link to a document in w3c stating that this is, indeed, proper behavior.)

ETA:
</fake html tag> (with &lt;) should work properly. I just remembered, because it was a comment like this that sent me investigating in the first place.

Date: 2007-07-13 08:14 am (UTC)
ext_78: A picture of a plush animal. It looks a bit like a cross between a duck and a platypus. (Default)
From: [identity profile] pne.livejournal.com
Yes, in HTML you can leave off the semicolon in some cases.

However, in XML (and, therefore, in XHTML) you cannot.

Maybe Gmail is using an XHTML parser? Or it's telling your browser that the page containing the comment notification email is XHTML, and your browser trusts the server and requires the semicolon then?

Date: 2007-07-13 01:06 pm (UTC)
From: [identity profile] homeworldfan829.livejournal.com
i think it's done in gmail due to encoding systems (UTF-8, Western..etc..).
maybe gmail translates it to an encoding where the code is not interpreted correctly html wise.

Date: 2007-07-13 03:46 pm (UTC)
From: [identity profile] camomiletea.livejournal.com
I remember that comment... I also use Gmail, so when you responded to my comment, I saw the &lt rather than < in the notification.

Date: 2007-07-14 04:41 am (UTC)
connie: (castle's embrace)
From: [personal profile] connie
Hello, I'm here on my Support friending spree, and apart from adding you, I also wanted to say thanks for being so welcoming - it's appreciated. :-)