The correct encoding for em-dash is supposedly —
, however when the semi-colon is left off it still displays correctly in my browers (chrome and firefox).
Furthermore, I'm using Litmus.com to test character encodings across several email clients. It turns out nearly all of them also ignore the required semicolon when displaying special characters with the exception of gmail (IE, chrome, and firefox).
So my question: Are encoded HTML special characters required to end in a semicolon? It seems like gmail is playing by the rules while everyone else ignores the required semi-colon.
Since HTML up to version 4.01 is SGML based it is possible to eliminate the final ;
, see w3centities.
Note. In SGML, it is possible to eliminate the final ";" after a character reference in some cases (e.g., at a line break or immediately before a tag). In other circumstances it may not be eliminated (e.g., in the middle of a word). We strongly suggest using the ";" in all cases to avoid problems with user agents that require this character to be present.
However, the current HTML5 working draft states that character references need to be terminated with a semicolon. In order to prepare your current sites for HTML5 I recommend you to end the references with a semicolon.
Browsers do their best to interpret your intentions and are somewhat forgiving. It's best to stick to the rules to ensure things work properly everywhere.
There have been several debates about the 'optional' semi-colon use-case. The best advice I can give you is to use it.
If the rule is using it causes ALL browsers to work and not using it causes MOST browsers to work, go with the ALL.
Plus, W3C states it here (though I can't find the full spec): http://www.w3.org/TR/html4/intro/sgmltut.html#h-3.2.3
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With