Results 1 to 2 of 2

Thread: Validating XHTML Question

  1. #1
    Join Date
    Feb 2006
    Thanked 0 Times in 0 Posts

    Default Validating XHTML Question

    OK I am using the W3C validator and I just started out making a simple website.

    I test the page and the validator passes it with a warning.

    "No Character encoding declared at document level"

    So I went in and used a meta tag and it worked perfectly.

    But then, I read on the W3C site, that instead of using a meta tag on all your pages you could just put an htaccess in the root directory.

    So I tried this

    I created a file called .htaccess and put it in the root directory, called "cold"

    So now in the "cold" directory I have two files


    The htaccess says:

    AddType 'text/html; charset=ISO-8859-1' html

    And that is all.

    When I use this form it fails to validate or rather it validates but gives me the warning back - "No Character encoding declared at document level"

    Am I using the right words in my .htaccess file? I use 1and1 for my webhost and I've used htaccess files for passcodes and they work fine. I've never used the file for something like this. Any ideas what is up? Or perhaps it doesn't work with 1and1?


  2. #2
    Join Date
    Mar 2005
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries


    I'm not sure about the .htaccess file (though that looks about right - I'd generally prefer UTF 8 encoding if workable in your host environment). But here's how it works from the validator's point of view - The validator doesn't know what you have like that, so it will continue to give the warning regardless of any server side code. It is after all just a warning. So if you have followed all of the instructions for the .htaccess file properly and are allowed by your host to be using one, everything should be fine, just ignore the warning.

    However, various encodings allow for certain characters and not others. To get the validator to check the validity of your code in the encoding that you have set for the page in .htaccess or by other server side methods, you must tell the validator what encoding you are using. There is a place on the validator form where you may select the encoding that the validator should use when checking your page.
    - John

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


Posting Permissions

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