in reply to Re^4: Ordering meta tags with HTML::Element
in thread Ordering meta tags with HTML::Element

You have to know the encoding, and you have have to know it first, not after mish-mashing things together and guessing and hoping and blaming the spec.

In an ideal world, with HTML spec'd and written for a single-pass parser, yes. In this world, no. Any browser procesing HTML, valid or tag soup, classic or XHTML, is generally using several steps to process input. One of them is to find the encoding. A HTTP "Content-Type" header with a "charset" is one of the ways to find out the encoding, meta tags are a second way, and Byte Order Marks are also used, plus a lot of heuristics.

That works quite well:

The order used may differ from browser to browser, but a readable meta tag usually wins over HTTP headers.

Alexander

--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

Replies are listed 'Best First'.
Re^6: Ordering meta tags with HTML::Element
by Your Mother (Archbishop) on Jun 15, 2016 at 13:21 UTC
    The order used may differ from browser to browser, but a readable meta tag usually wins over HTTP headers.

    I thought that's what I said. :P Also of note if we're kitchen sinking it is that there have been serious security implications of not having the charset right; utf-7-xss-attacks-in-modern-browsers.