Specify a character set early

Rule from network under performance category

What is a trooper!

we have submitted your edit to the community for review! We'll review and make it live on the site in the next few hours, the internet thanks you :).

Browse another section of the knowledge base



Suggest an edit

Cancel

This rule has no content... yet.

Add content to this rule

Or just browse to view rules that have content



 

Setting the character set of your HTML and text responses is important as it allows browsers to immediately start executing scripts and parsing and avoid olders browsers like IE6 from type sniffing. If not specified the browsers are left in charge of figuring out the character set and could produce intended results.

When a charset is specified in a header, often refered to as setting the character set at the server level reduces browser processing, the can reduce browser processing and avoid sniffing by older browsers like IE6.

How do I fix this ?

The fix is to enable the header on any HTML/TEXT responses from the server, either individually or globally.

To enable in Apache (and probably most shared hosting solutions), create a .htaccess in the root of your website with the following content:

AddDefaultCharset UTF-8

Enabling in NGINX is easy as well, just add the charset property to the NGINX server block. This will set the charset on responses where appropriate. An example of enabling the setting would be editing the files in /etc/nginx/(conf.d|sites-enabled|sites-available)/ with the following config:

server {
   # other server config...
   charset utf-8;
}

Resources

Browse another section of the knowledge base



Signup icon
Ready to see how well your site scores?

Passmarked works best when you have an account. It allows you to keep a dashboard with saved data of the sites you have run through the system, we’ll alert you about important updates and you get access to the Passmarked Slack forum.

Sign up to get started