I'm trying to optimize the way my framework handles HTML5 pages generation. Right now, what I do is to insert a right after the tag, so it's the first element to be specified (so when I pass the tag and the rest of page elements, it's already defined as being encoded in UTF-8).
The problem is I'm reading some books on website performance optimizations, and most of them recommends specifying the encoding through a Content-type declaration, rather than inserting a block.
The W3C documentation on character encoding detection (section 22.214.171.124) says, essentially, the HTTP headers have priority above any explicit declaration EXCEPT if the user declared an override for the content type through the user agent.
However, the W3C validator (which is why I use to debug my HTML code output) doesn't complaint but warns me about the absence of the block, thus encouraging me to put it (it says it's specially recommended if the rendered page is to be saved, which is not the case, but still... it confuses me a bit).