Will iso-8859-1 display german umlauts ok or do I need to use utf-8?

ade123 picture ade123 · Jan 6, 2011 · Viewed 18.4k times · Source

I have a multi language website that is hosted on a server that appears to have character encoding set to default to iso-8859-1.

I thought I would be best having the pages utf-8 and included a meta tag to declare this. Unfortunately this meta tag seems to get overridden and the page defaults to iso-8859.

Many special characters in the German and Dutch pages are not showing correctly.

Do I need to try and change the server default to utf-8 or something? Maybe I could remove the server default completly? Hmm... really not sure what's best to do here.

Any advice would be great!

Answer

BalusC picture BalusC · Jan 6, 2011

The HTML meta tags for the content type are not used when the HTML page is served over HTTP. Instead, the content type header in the HTTP response will be used. You can determine the content type header with for example Firebug, in the Net panel.

alt text

How to change this depends on the programming language and/or the webserver which you are using, which is unclear from your current question. As per you question history, you seem to be using PHP. In that case, you need to add the following line to the PHP file, before you emit any character to the response.

header('Content-Type: text/html; charset=UTF-8');

See also:


If you're unable to change the HTTP response header, you have to give more detail about the programming language and webserver which you're using. This way we can give you better suited answers.

If you want to stick to ISO-8859-1, then you need to ensure that your pages are saved as ISO-8859-1 as well instead of as UTF-8. Otherwise some characters may indeed go mojibake when you display a UTF-8 saved resource as ISO-8859-1.