html php meta charset UTF-8 not working? [duplicat

2019-05-27 09:53发布

问题:

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.

回答1:

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');


回答2:

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.