Trouble with http header specifying character encoding iso-8859-1 rather than utf-8

character encodinghttp-headersiso-8859-1utf-8

I have recently designed a website that contains German and Dutch characters and I would like the page to use character encoding utf-8.

I have added the xml declaration:

<?xml version="1.0" encoding="UTF-8"?>

and the meta tag:

<meta http-equiv="content-type" content="text/html; charset=UTF-8" />

When I viewed the website on-line, the special characters found in the German text were not displaying correctly. When I tried validating the page with the w3c validator, I got the following warning:

The character encoding specified in the HTTP header (iso-8859-1) is different from the value in the XML declaration (utf-8). I will use the value from the HTTP header (iso-8859-1).

Is this a server issue? It's just that I have uploaded the same files to a different server of mine and the pages display correctly there using utf-8.

Any help or advice regarding how I would go about getting the page to encode as utf-8 would be greatly appreciated.

I'm stumped!


Thanks to jason, I found a file named mod_mime-defaults.conf

this file contains the following:

# AddDefaultCharset UTF-8
AddDefaultCharset ISO-8859-1

If I remove the # from before AddDefaultCharset UTF-8, do you think this will help? Or maybe add a # before AddDefaultCharset ISO-8859-1.

I tried editing this file, but I don't think I have permission. Hmmm…?

Best Answer

This could be a server issue.

If you are using Apache check the Apache config file usually located here /etc/httpd/conf/httpd.conf on a *nix server, for the value of AddDefaultCharset.

This setting specifies the default for all content served. If it is commented out, that means it will rely on the browser's, or META settings to determine the Charset.