PHP特殊字符未显示[重复]

This question already has an answer here:

Can anyone help with with special characters and php.

The following php:

$IHaventReceivedCode = "Je n'ai pas reçu mon code";

is showing as:

Je n'ai pas re�u mon code

I have tried adding to the file at the top:

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

and also to the head tag:

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

However, the character fails to show.

Any ideas?

</div>

Try to convert the document to that encoding. If for example you are using Notepad++ you can do the following:

enter image description here

If your files are in UTF-8... You can try utf8_encode
$IHaventReceivedCode = utf8_encode("Je n'ai pas reçu mon code");

Or decode utf8_decode
$IHaventReceivedCode = utf8_decode("Je n'ai pas reçu mon code");

I'm pretty sure that one of them should change the output...

Use a text editor that supports different encoding. If you're using Notepad try switching to a more sophisticated text editor.