Are encoded HTML characters special characters needed to complete with a semicolon?

The correct em-dash encoding is supposedly — however, when the comma is off, it still displays correctly in my browers (chrome and firefox).

In addition, I use Litmus.com to check character encodings on multiple email clients. It turns out that almost all of them also ignore the required semicolon when displaying special characters, with the exception of gmail (IE, chrome and firefox).

So my question is: are the special HTML characters encoded to complete with a semicolon encoded? Gmail seems to play by the rules, while everyone else ignores the required half-hour.

+4
source share
4 answers

Since HTML up to version 4.01 is based on SGML, you can exclude the final one ; see w3centities .

Note. In SGML, you can exclude the final ";" after a symbolic link in some cases (for example, when breaking a line or immediately before the tag). In other circumstances, it cannot be eliminated (for example, in the middle of a word). We strongly recommend the use of ";" in all cases, to avoid problems with user agents that require the presence of this symbol.

However, the current working HTML5 working draft argues that symbolic links must end with a semicolon. To prepare your current sites for HTML5, I recommend that you end the links with a semicolon.

+6
source

Browsers do their best to interpret your intentions and forgive a little. Itโ€™s best to follow the rules to ensure that everything works properly.

+4
source

There has been some debate about the โ€œoptionalโ€ semicolon precedent. The best advice I can give you is to use it.

If this rule is used, then ALL browsers work, and not using it, make MOST browsers work with ALL .

Plus, the W3C states it here (although I cannot find the full specification): http://www.w3.org/TR/html4/intro/sgmltut.html#h-3.2.3

+1
source

Yes, they should have a half in the end. However, the browser does forgive most of the time and tries to interpret it. Here is an example where it might fail:

this & ampthat will return this&that - FAIL

while

this&that will return this&that - WORK

0
source

Source: https://habr.com/ru/post/1443505/


All Articles