SitePoint Sponsor

User Tag List

Results 1 to 8 of 8

Thread: HTML5 Char Set

  1. #1
    SitePoint Zealot Bootfit's Avatar
    Join Date
    Jun 2005
    Location
    Liverpool, UK
    Posts
    149
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    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:

    Code:
    <meta http-equiv="Content-Type" content="text/html; UTF-8" />
    and
    Code:
    <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?

  2. #2
    SitePoint Enthusiast
    Join Date
    Dec 2007
    Posts
    36
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.
    Comcure does independent, off-site website backups just for the webmaster
    Full API. Daily Snapshots. Backup via FTP, FTP over TLS or SFTP.
    Storage Pods in USA, Europe and Asia to come. Backup to the closest one.

  3. #3
    SitePoint Zealot Bootfit's Avatar
    Join Date
    Jun 2005
    Location
    Liverpool, UK
    Posts
    149
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So if I add the above code to the .htaccess file I don't have to specify a charset in the header?

  4. #4
    SitePoint Enthusiast
    Join Date
    Dec 2007
    Posts
    36
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.
    Comcure does independent, off-site website backups just for the webmaster
    Full API. Daily Snapshots. Backup via FTP, FTP over TLS or SFTP.
    Storage Pods in USA, Europe and Asia to come. Backup to the closest one.

  5. #5
    SitePoint Zealot Bootfit's Avatar
    Join Date
    Jun 2005
    Location
    Liverpool, UK
    Posts
    149
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Spot on - cheers mate. I'll give that a go tonight.

  6. #6
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    23,614
    Mentioned
    413 Post(s)
    Tagged
    7 Thread(s)
    When you say "it doesn't pass", what does that mean? You don't need the closing slash in HTML5. This shoud be fine:

    Code:
    <meta charset="utf-8">

  7. #7
    SitePoint Zealot Bootfit's Avatar
    Join Date
    Jun 2005
    Location
    Liverpool, UK
    Posts
    149
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by ralph.m View Post
    When you say "it doesn't pass", what does that mean?
    I mean the google page speed checker picks up I haven't specified a Character Set - although I thought I had.

    Quote Originally Posted by ralph.m View Post
    You don't need the closing slash in HTML5
    Really? I have closing / in all my metas and the page passes the html5 validation.

  8. #8
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    23,614
    Mentioned
    413 Post(s)
    Tagged
    7 Thread(s)
    Quote Originally Posted by Bootfit View Post
    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.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •