My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for
SpecifyCharsetEarly  
Describes the Specify a Character Set Early rule.
Updated Feb 16, 2010 by sker...@google.com

Specify a Character Set Early

HTML5 requires browsers to buffer a response when a character set is not specified in the Content-Type header or an HTML <meta> tag. Thus, we recommend always specifying a character set for HTMl documents.

Details

We tested character set buffering behavior with the following popular browsers:

  • Internet Explorer: All versions of IE tested did not buffer responses. In contrast, all the other browsers tested do buffer when a character set is not specified. Note that when a character set is specified late in the document, Internet Explorer will redraw the page using the specified character set if it is not the same as the default character set.
  • Firefox: Through version 3.5, specifying the Content-Type header as text/html, without specifying a character set, disables buffering in Firefox. Without a Content-Type header, Firefox buffers up to 1024 bytes. Firefox 3.6 buffers 512 bytes.
  • Chrome: Chrome buffers up to 1024 bytes when a character set is not specified. Chrome will parse a character set from either the Content-Type HTTP header or the HTML META tag.
  • Safari: Safari always buffers 1024 bytes, regardless of the contents of the Content-Type header or html META tag.

See also

No Tech Support Here: Please use comments to give suggestions for improving this wiki page. If you have a question, please send email to page-speed-discuss@googlegroups.com . Questions asked here will not be seen by people who can answer them.

Comment by dgu...@gmail.com, Feb 15, 2011

typ: "HTMl" documents? That's either a lower-case 'l' or an upper-case 'i', but should be fixed nonetheless...

Comment by rafalf...@gmail.com, Aug 14, 2011

If you need information for Apache, please check http://www.askapache.com/htaccess/setting-charset-in-htaccess.html

Comment by soca...@gmail.com, Mar 4, 2012
Comment by robert.s...@gmail.com, Apr 5, 2012

W3 says that with 304 headers (cached pages) Content-Type and charset SHOULD NOT be inserted. Google Page Speed is not able to detect if an HEADER is 200 OK or 304 Not Modified ?


Sign in to add a comment
Powered by Google Project Hosting