Re: Polyglot Markup/XML encoding declaration

Jirka Kosek, Thu, 29 Jul 2010 15:43:44 +0200:
> Leif Halvard Silli wrote:
> 
>> E.g. a typical polyglot - UTF-8 encoded, that is - could start like 
>> this:
>> 
>> ]]
>> <?xml version="1.0" ?>
>> <!DOCTYPE html>
>> <head>
>>   <meta charset="UTF-8"/>
>> [[
> 
> XML declaration is optional if document is encoded in UTF-8/16. 

My paraphrasing of the XML 1.0 spec is a little bit different that 
yours: The XML _encoding_ declaration is optional whenever the encoding 
in use is UTF-8/-16. Whereas the very XML declaration itself ... is 
always a SHOULD. SHOULD is not meant to be a synonym with "optional", 
even if it often in praxis perhaps is.

> So why
> to use it at all -- it will just cause troubles to UAs parsing this
> stuff with HTML parser.

No, it will not cause trouble in a HTML5 conforming UA.
-- 
leif halvard silli

Received on Monday, 2 August 2010 00:59:28 UTC