views:

145

answers:

3

I have a website which has some non standard characters such as ë, Ç etc.

The website uses ISO-8859-1 as it's character encoding, however at this point I want to switch it to UTF-8 for some reasons related to rss feeds.

When i change the character encoding to utf-8 the mentioned characters are displayed incorrectly.

I set the charset through the php header function:

header("Content-Type: text/html; charset=ISO-8859-1");

Any idea as to how to fix this problem ?

A: 

Never heard about entities ? http://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references .

Else, you have to reencode your files (with your editor, you should be able to save your files specifying an encoding).

You can also do it with external programs, like iconv

iconv -f ISO-8859-1 -t utf8 your_file > your_new_file
Scharron
Thanks I downloaded some utility to reencode my files to utf-8 and it worked.
Aldo
-1 for your advice to use entities but +1 for the right hint to reconvert the files ;)
Kau-Boy
deceze
A: 

If you are storing that information in the database, check the database collation, it must be UTF-8 also.

Flakron Bytyqi
+1  A: 
header("Content-Type: text/html; charset=ISO-8859-1");

So, are you using ISO-8859-1 or UTF-8? This header is telling the browser "please assume the content of this site is encoded in ISO-8859-1 and interpret it as such." If the content of the site is not actually in this encoding, the result will be gibberish to some extend.

This goes to say that the problem is that what it says on the label is not actually what's in the can.

deceze