SitePoint Sponsor

User Tag List

Results 1 to 12 of 12
  1. #1
    SitePoint Zealot
    Join Date
    Nov 2008
    Location
    Germany
    Posts
    119
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    HTML5 Charmod validation problems

    Hi,

    in the html5 validator i get
    Error: The encoding utf8 is not the preferred name of the character encoding in use. The preferred name is utf-8. (Charmod C024)
    which means
    Content and software that label text data MUST use one of the names required by the appropriate specification (e.g. the XML specification when editing XML text) and SHOULD use the MIME preferred name of a character encoding to label data in that character encoding.

    An error is reported if an encoding label is not the MIME preferred name.
    so what exactly does that mean?
    My whole Debian is utf-8 and my html head is
    Code:
    <!DOCTYPE html>
    <html lang="de">
    <head>
    <meta charset="utf-8" />
    and saved as utf-8 in Dreamweaver.

    regards from germany
    Glasspoole

  2. #2
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,185
    Mentioned
    191 Post(s)
    Tagged
    2 Thread(s)
    What Content-type charset HTTP header is the server using?

  3. #3
    SitePoint Zealot
    Join Date
    Nov 2008
    Location
    Germany
    Posts
    119
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hm, know i wonder. Apache is sending utf8 and not UTF-8.
    Does that make a difference?

    Ok, i checked the server ip and i get UTF-8. I checked the adress from the Magento Shop and i get UTF-8. If i check the adress where im playing with html5 (ExpressionEngine) i get utf8. Ok, i also checked a single html file and i get UTF-8 and it validates.
    Everything in ExpressionEngine is set to UTF-8 so its a EE error.

    Thanks for pointing me in the right direction.

  4. #4
    SitePoint Zealot
    Join Date
    Nov 2008
    Location
    Germany
    Posts
    119
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok, it was not ExpressionEngine, it was the php.ini. There i left the "-".
    Little mistake, big impact

    That brings me to the next questions.
    Does it make i difference if i write "utf" or "UTF".
    And is my MySQL configuration correct.
    Cause there i have no "-" in the charset.

    my.cnf:
    Code:
    [client]
    default-character-set = utf8
    
    [mysqld]
    default-character-set = utf8
    character-set-server = utf8
    collation-server = utf8_unicode_ci
    init_connect = 'SET collation_connection = utf8_unicode_ci'
    init_connect = 'SET NAMES utf8'
    
    [mysqldump]
    default-character-set = utf8
    
    [mysqlimport]
    default-character-set = utf8
    
    [mysql]
    default-character-set = utf8

  5. #5
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,185
    Mentioned
    191 Post(s)
    Tagged
    2 Thread(s)
    Good questtion that I wish I had the answer to.

    As far as I can remember, I've used both "utf-8" and "UTF-8" in HTML and XML files and never got any complaints. Not that that means it was OK, but at least it didn't break anything outright.

    It seems MySQL does indeed use
    SET NAMES utf8
    but I don't know if it recognizes that syntax in other areas.

    This is one place where consistancy would be a nice thing to have.

  6. #6
    SitePoint Enthusiast
    Join Date
    Nov 2008
    Posts
    65
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Glasspoole View Post
    in the html5 validator i get
    If you're using the W3C validator, you can't use the shorthand meta element to declare character encoding (<meta charset="utf-8" />). I'm assuming the reason is because not all browsers will currently recognize this meta element. If you're using Henri's validator then I'm not sure - I'll take a closer look if that is the case.

  7. #7
    SitePoint Zealot
    Join Date
    Nov 2008
    Location
    Germany
    Posts
    119
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    @chris cressman,
    for html5 there is the html5 validator

    The W3C validator is also not correct for XHTML (http://schneegans.de/sv/)

    I had the hope that you can ask questions at the MySQL Performance Blog, but you can't. So we need a MySQL guru to answer the question where in the MySQL settings a "-" is needed and where not

  8. #8
    bronze trophy
    Join Date
    Dec 2004
    Location
    Sweden
    Posts
    2,670
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Glasspoole View Post
    Does it make i difference if i write "utf" or "UTF".
    No (at least not in HTTP, HTML or XML).
    Quote Originally Posted by Glasspoole View Post
    And is my MySQL configuration correct.
    Cause there i have no "-" in the charset.
    The MySQL configuration uses keywords that are independent of the IANA encoding names. I would expect that "utf-8" does not work at all in the MySQL configuration file.
    Simon Pieters

  9. #9
    bronze trophy
    Join Date
    Dec 2004
    Location
    Sweden
    Posts
    2,670
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by chris cressman View Post
    If you're using the W3C validator, you can't use the shorthand meta element to declare character encoding (<meta charset="utf-8" />).
    You can if you're using the HTML5 doctype or choose "HTML5" in the doctype override.

    Quote Originally Posted by chris cressman View Post
    I'm assuming the reason is because not all browsers will currently recognize this meta element.
    They do.
    Simon Pieters

  10. #10
    SitePoint Enthusiast
    Join Date
    Nov 2008
    Posts
    65
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by zcorpan View Post
    You can if you're using the HTML5 doctype or choose "HTML5" in the doctype override.

    They do.
    Thanks Simon, but I'm still getting two warnings when I use the shorthand declaration, and one of them says the character encoding cannot be determined and utf-8 is assumed. For now I'll just stick with the longer declaration or use Henri's validator (http://validator.nu/).

  11. #11
    bronze trophy
    Join Date
    Dec 2004
    Location
    Sweden
    Posts
    2,670
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by chris cressman View Post
    Thanks Simon, but I'm still getting two warnings when I use the shorthand declaration, and one of them says the character encoding cannot be determined and utf-8 is assumed.
    Ah. Seems like a known bug.

    http://www.w3.org/Bugs/Public/show_bug.cgi?id=7135
    http://www.w3.org/Bugs/Public/show_bug.cgi?id=5992
    Simon Pieters

  12. #12
    SitePoint Zealot
    Join Date
    Nov 2008
    Location
    Germany
    Posts
    119
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    @chris, and the good thing about
    Code:
    <!DOCTYPE html>
    is that every browser will be in standarts mode.


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
  •