HTML5 Char Set

I’ve got a site that I’m trying to optimise for Google Page Speed.

There’s a couple of issues that are still outstanding; one telling me I need to Specify a Character Set

I’ve tried with two separate Char Sets:

<meta http-equiv="Content-Type" content="text/html; UTF-8" />


<meta charset="UTF-8" />

…with neither passing Page Speed check.

What am I doing wrong? What is the correct Char Set for an HTML5 page?

Do you administer the server this is on? If not, try to add this to .htaccess:

AddDefaultCharset Off
AddCharset ISO-8859-1 .html
AddCharset ISO-8859-1 .htm
AddCharset UTF-8 .xml

If you’re serving as XHTML 1.0 you officially must specify the charset in the headers.

So if I add the above code to the .htaccess file I don’t have to specify a charset in the header?

It won’t hurt to specify it (the same) in both, but no, if you add the above then it should be in the headers, which is XHTML 1.0 compliant.

Spot on - cheers mate. I’ll give that a go tonight.

When you say “it doesn’t pass”, what does that mean? You don’t need the closing slash in HTML5. This shoud be fine:

<meta charset="utf-8">

I mean the google page speed checker picks up I haven’t specified a Character Set - although I thought I had.

Really? I have closing / in all my metas and the page passes the html5 validation.

Yes, either is OK in HTML5. But personally, I think it looks messy. :slight_smile: