W3C home > Mailing lists > Public > public-html@w3.org > August 2010

Re: Polyglot Markup/XML encoding declaration

From: Leif Halvard Silli <xn--mlform-iua@xn--mlform-iua.no>
Date: Mon, 2 Aug 2010 02:57:51 +0200
To: Jirka Kosek <jirka@kosek.cz>
Cc: Leif Halvard Silli <xn--mlform-iua@xn--mlform-iua.no>, Henri Sivonen <hsivonen@iki.fi>, HTMLwg <public-html@w3.org>, Eliot Graff <eliotgra@microsoft.com>, public-i18n-core@w3.org
Message-ID: <20100802025751253705.67f1577b@xn--mlform-iua.no>
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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 2 August 2010 00:59:30 GMT