causes a HTML5 validation fail
I'm in the process of applying a "HTM开发者_如何学GoL4.5" approach to an existing XHTML1.0 Strict site. The idea is to change the doctype and apply semantic classes matching the new elements of HTML5 (<div class="aside">
, etc.) and do all that I can get away with, without Internet Explorer(IE) breaking (e.g. applying new <input>
type attributes).
The only problem I've encountered is that W3C's validator doesn't like
or ©
, while html5.validator.nu has no problem.
I know that HTML5 validators are experimental at this stage. Should I replace
with something? If so, what?
My charset on this particular site is UTF-8
.
is fine in the text/html
HTML5 and it validates for me at W3.
Where it won't validate is in XHTML5. The only built-in entities in XML are &
, <
, >
, "
and '
. XHTML1 brought in the HTML entity list by means of the DTD referenced by <!DOCTYPE>
, but (X)HTML5 no longer uses a DTD, so that means in the XML serialisation you can't use the HTML entities.
A character reference such as  
is still okay. And if you're serving your page in the right encoding you can just include a U+00A0 No-Break Space character directly without escaping:
. (Of course that's going to be annoying to edit if your text editor doesn't visually distinguish the no-break and standard space.)
Simply replace all the
with  
精彩评论