2

Possible Duplicate:
Browser displays � instead of ´

i'm kind of stuck on a php file with almost only html in it. I use PHP only to send information from a contact form to my mail adres.

When developing the website on localhost everything was all fine. After uploading to my server it messes up the special characters.

My meta tag looks like this:

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

If someone could please help me it would be highly appreciated.

Community
  • 1
  • 1
Boudewijn Smit
  • 177
  • 2
  • 4
  • 13
  • 1
    Is your file encoded as UTF-8 (the fileformat, not the declaration you showed)? The encoding will be done by your editor/ide, use UTF-8 without BOM header. – martinstoeckli Sep 05 '12 at 07:51
  • 1
    Meta Tags are fallbacks that will only get applied if the webserver is not setting appropriate headers. If the webserver sends a content-type, meta has no effect, so check the Response Headers and modify accordingly. – Gordon Sep 05 '12 at 07:53
  • [Handling Unicode Front To Back In A Web App](http://kunststube.net/frontback/) – deceze Sep 05 '12 at 07:56
  • I think it is, not sure though. I'm using Textmate as editor. When i click file>re-open with encoding>UTF8 and upload to my server again. It makes no difference. – Boudewijn Smit Sep 05 '12 at 07:59

2 Answers2

15

Add this to the header in your php file and let me know if it solves or not -

header('Content-Type: text/html; charset=UTF-8');
swapnesh
  • 26,318
  • 22
  • 94
  • 126
  • Great! That's it, thanks a bunch! Can you explain me why this needs to be done? – Boudewijn Smit Sep 05 '12 at 08:04
  • @Swapnesh, I have an issue where i am trying to write 'Hindi' string to MySQL database PHP is converting that to '????' and that is what i can see in mysql. To isolate issue when i directly put that in mysql it writes it correctly. do you have any idea how i ca resolve this issue. (my database and tables are in UTF8, PHP configuration set to UTF8) – SmartDev Nov 07 '13 at 06:22
0

If your browser is specifically styled to have the character set as ISO-8859-1 or another charset, it will still display in that charset. I think that's the only problem I can detect.