PDA

View Full Version : No Character encoding declared at document level


blanchard
02-13-2010, 11:52 AM
Hello all,
I've validated a website page over at W3C and the pages passes but I get 1 Warning:

No Character encoding declared at document level

How do I remove the warning?

http://validator.w3.org/check?uri=http%3A//www.thomasblanchard.co.uk/&charset=(detect+automatically)&doctype=Inline&group=0&user-agent=W3C_Validator/1.654

gentleone
02-13-2010, 12:13 PM
Hello all,
I've validated a website page over at W3C and the pages passes but I get 1 Warning:

No Character encoding declared at document level

How do I remove the warning?

http://validator.w3.org/check?uri=http%3A//www.thomasblanchard.co.uk/&charset=(detect+automatically)&doctype=Inline&group=0&user-agent=W3C_Validator/1.654

You have to encode the HTTP header as well. Put this at the first line of your page (in the source) so above your doctype:
<?xml version="1.0" encoding="UTF-8"?>

If your page is a PHP document then use this one:
<?php header('Content-Type:text/html; charset=UTF-8'); ?>

blanchard
02-14-2010, 05:28 PM
Hello all,
OK I now know the reason for getting the No Character encoding declared at document level Warning message.

If you have bought your domain name from a different place to your webspace and you use "Framed Web-forwarding" then you'll get the message.

If you change your setting to Non-Framed Web-forwarding then you'll get the normal validation pass/errors. But then in your address bar you'll see the link to your hosted webfiles rather than the www. domain name you bought elsewhere.

So the best way to fix this is to have both files and domain name hosted at the same place.