I spent the last few hours getting my website to validate HTML 4.01 Strict and I actually have succeeded in that but there is still one warning which I can\'t get rid of. Th
The server is clearly marking the document as ISO-8859-1 in the HTTP headers. Try saving default.html using UTF-8 encoding with a proper editor.
Can you remove AddDefaultCharset
from .htaccess
and check the encoding? I saved the HTML source of your webpage and opened it. Encoding was detected as UTF-8. However, on viewing the same webpage served by your webserver, the encoding is ISO-8859-1. That is why I suggest removal of the former redundant rule.
You need to replace the HTTP-level header.
This should work:
<?php
header('Content-type: text/html; charset=utf-8');
?>
Note that the above must be the FIRST thing in your file. No exceptions. See http://us2.php.net/manual/en/function.header.php
For general info on how to change the character set header in different web stacks, see http://www.w3.org/International/O-HTTP-charset
Larry
Okay, I have come up with a partial solution to my problem. As it was only the default.html file which was causing the warning I assumed that the server was doing something special to it because of its name. So I made a new file called home.html with the same contents as the default.html file and pointed the .htaccess file to the new file (see line 3 below).
# Use PHP5 as default
AddHandler application/x-httpd-php5 .php
DirectoryIndex home.html
AddDefaultCharset UTF-8
This fixed the problem and all files are now recognised as UTF-8. I'm still not sure what the server was doing to the default.html file or where the settings concerning that are but as my problem is gone I will forget about that.
include this in your code:
<meta charset="utf-8" />