Is the use of the null entity (e.g �) valid in HTML5?

前端 未结 1 1236
孤独总比滥情好
孤独总比滥情好 2021-01-23 10:20

I believe the null entity () is officially invalid in XML. But I have encountered it when processing HTML. (Perhaps to represent a kind of

相关标签:
1条回答
  • 2021-01-23 11:08

    No, it's not valid HTML5. You can easily see this by running the following fragment through a validator such as W3C's:

    <!DOCTYPE html><title>&#x0;</title>
    

    Which will result in the following error:

    Line 1, Column 27: Character reference expands to zero.

    The specific code points that are not legal in character references are listed in the spec (W3C HTML5, WHATWG HTML Living Standard):

    The numeric character reference forms described above are allowed to reference any Unicode code point other than U+0000, U+000D, permanently undefined Unicode characters (noncharacters), surrogates (U+D800–U+DFFF), and control characters other than space characters.

    0 讨论(0)
提交回复
热议问题