[Zope-dev] Content Type Meta tag stripping in zope.pagetemplate

Charlie Clark charlie.clark at clark-consulting.eu
Tue Mar 27 08:54:13 UTC 2012


Am 25.02.2012, 00:18 Uhr, schrieb Marius Gedminas <marius at gedmin.as>:

> The HTML spec requires that:
>  "To sum up, conforming user agents must observe the following
>    priorities when determining a document's character encoding (from
>    highest priority to lowest):
>    1. An HTTP "charset" parameter in a "Content-Type" field.
>     2. A META declaration with "http-equiv" set to "Content-Type" and a
>        value set for "charset".
>     3. The charset attribute set on an element that designates an
>        external resource."
>            -- http://www.w3.org/TR/html4/charset.html#h-5.2.2

> (Aside: The rationale for this ordering, IIRC, is that it allows HTTP
> servers to do on-the-fly charset conversion from one 8-bit charset to a
> different one, without having to parse HTML and modify the charset name
> in the <meta> declaration.)

As a follow up to this it's worth noting that as from Opera 12 the  
practice will be:

	* BOM sniffing
	* http header
	* meta declaration

In that order and inline with Webkit and IE:

"""
It is better to encode your Web pages in UTF-8, and serve them as such. In  
HTTP, the HTTP header has priority, then the meta name contained in HTML.  
Some Web pages have specific encoding. It happens often on the Web that  
the Web page encoding is different from the one specified in the file  
and/or the one specified in HTTP headers. It creates issues for users who  
receive unreadable characters on their screens. So the browsers have to  
fix the encoding on the fly. We had bug reports about Web sites sending  
BOM different from the HTTP header. We decided to make the BOM  
authoritative like webkit and IE, because there are more chances for it to  
be exact than the HTTP headers.
"""

http://my.opera.com/ODIN/blog/2012/03/26/whats-new-in-opera-development-snapshots-march-26-2012

Charlie
-- 
Charlie Clark
Managing Director
Clark Consulting & Research
German Office
Kronenstr. 27a
Düsseldorf
D- 40217
Tel: +49-211-600-3657
Mobile: +49-178-782-6226


More information about the Zope-Dev mailing list