Results 1 to 5 of 5

Thread: W3 Validator not recognising character encoding

  1. #1
    Join Date
    Sep 2008
    Location
    Bristol - UK
    Posts
    842
    Thanks
    32
    Thanked 132 Times in 131 Posts

    Default W3 Validator not recognising character encoding

    I know it's not really a big issue, but for some reason the W3 validator doesn't pick up on my character encoding although it is in the code, the document is .php but I didn't think would change it in any way:

    http://validator.w3.org/check?uri=ht...oldnb.co.uk%2F

    As you can see it's only a warning but then if you look on the site and the source code it says:

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>Bristol DNB - Listing all the drum &amp; bass nights in Bristol</title>
    <meta name="description" content="bristol dnb, bristol drum and bass, bristol d&amp;b, bristol d'n'b, bristol drum and bass nights, bristol dnb nights, bristol dnb clubs"/>
    <meta name="keywords" content="Listings for drum and bass events in Bristol, UK"/>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> 
    
    <base target="_blank"/>
    <link rel="stylesheet" type="text/css" href="styles/styles.css"/>
    <link rel="shortcut icon" href="images/favicon.ico"/>
    <link rel="stylesheet" href="css/lightbox.css" type="text/css" media="screen" />
    
    <script type="text/javascript" src="js/prototype.js"></script>
    <script type="text/javascript" src="js/scriptaculous.js?load=effects,builder"></script>
    
    <script type="text/javascript" src="js/lightbox.js"></script>
    
    <script type="text/javascript">
    function DoClear(text) {
    	if (text.value == text.defaultValue){
    		text.value = "";
    		text.style.color = "#66cc33";
    	}
    }
    
    </script>
    
    </head>
    As you can see, it's there, but just not being found by the validator.

    So what I want to know is - is this a problem with the validator itself or is there a flaw in my coding?

    Thanks for any help given,

    Jack
    Last edited by Schmoopy; 01-15-2009 at 10:33 AM.

  2. #2
    Join Date
    Oct 2008
    Location
    Sweden
    Posts
    2,023
    Thanks
    17
    Thanked 319 Times in 318 Posts
    Blog Entries
    3

    Default

    Take a look at this article, it might help you out:
    http://www.webdevout.net/articles/beware-of-xhtml

    It's long but it's worth a reading.

  3. #3
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    It's my understanding that the meta tags should come before the title tag. And that only the Content-Type meta tag may follow it, but that it may also precede it.

    However, simply by adding an empty body section and a closing </html> tag to the code from your post, it validates here.

    And if I validate this URL:

    Code:
    http://www.bristoldnb.co.uk/index.php
    instead of:

    Code:
    http://www.bristoldnb.co.uk/
    I get a different set of errors. Here is the code validated at http://www.bristoldnb.co.uk/:

    Code:
    Source Listing
    
    Below is the source input I used for this validation:
    
       1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
       2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
       3.
       4. <html xmlns="http://www.w3.org/1999/xhtml">
       5. <head>
       6. <title>Bristol DNB - Home</title>
       7. <meta http-equiv="Refresh" content="0;url=http://www.bristoldnb.co.uk/index.php" />
       8. </head>
       9. <body>
      10. </body>
      11. </html>
    So you see, you weren't really validating the index page.
    Last edited by jscheuer1; 01-15-2009 at 06:55 AM. Reason: add info about URL's
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  4. #4
    Join Date
    Sep 2008
    Location
    Bristol - UK
    Posts
    842
    Thanks
    32
    Thanked 132 Times in 131 Posts

    Default

    Ohhh, how did I forget that >.<, yea completely forgot I was redirecting it, jesus I'm dumb

  5. #5
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Note that a <meta> tag will always be overridden by the equivalent HTTP header, and the HTTP header is the preferable way to go (although a <meta> tag can often be useful to allow the information to be preserved if the page is saved and later accessed offline).

    Don't forget to read Snookerman's article.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

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
  •