views:

11

answers:

1

hello!

i wrote some html with utf-8 charset. in the head of the html there is also a

<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> 

everything works fine in local, but when i upload files to the server, i see all my letters

àèìòù etc

distorted.

anybody know how could it be the problem? is possible that the server force a charset that isn't utf-8?

thanks a lot

+2  A: 

Actually the META tag is not all you need for correct UTF-8 encoding. Your server might still send the page as Content-Type: text/html; charset=ISO-8859-1 in the header of the page.

You can check the headers e.g. with the Live HTTP Headers Firefox add-on.

There is a lot of secret sauce with UTF-8 encoding and making it work, you might want to go through this page (UTF-8: The Secret of Character Encoding) which explains everything you need to know and gives you advice on how to solve encoding problems.

To answer your question: Yes it is possible to force the server to use UTF-8, e.g. by using the PHP headers() function like so:

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

moontear
thanks a lot for the really interesting link!i was also trying this method AddDefaultCharset utf-8 in the .htacess but it wasn't working. yours works perfectly! :)
Luca