PageSpeed: Specify a character set early
Setting the character set at the server level reduces browser processing.
- Define the character set being used at the server for all pages
- Avoid setting it in the meta http-equiv tag
- Reduce page load times
- Cost benefit ratio: high value
- Server access needed
How does your site score on this recommendation?
What is a character set definition?
A character set is essentially a set of characters represented by numbers for a computer. For example in the ASCII character set the numbers 0-127 are used to represent all English characters as well as special control characters.
Why is it important?
It's important to specify a character set in the HTTP response headers of your HTML documents to allow the browser to begin parsing HTML and executing scripts immediately.
Without specifying a character set the browser is left to figure it out on its own which takes time and therefore negatively impacts your page load times.
Why should you avoid setting it in the meta http-equiv tag?
Setting the character set in the meta http-equiv tag disables the lookahead downloader in Internet Explorer 8. Disabling the lookahead downloader can substantially increase the amount of time it takes to load your page.
Web developers should specify the CHARSET in the HTTP Content-Type response header, as this ensures that the performance benefit of the Lookahead Downloader is realized.
How to do it?
In order to avoid using meta tags you must set the Character Set from the Server.
This is the most efficient method to set the character set, because you don't need to set it for every page. Set your server to send a Content-Type header for all documents it serves that are of type text/html. For example:
Content-Type: text/html; charset=UTF-8
Charset is where you set your character type.