2

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?

Linus Caldwell
  • 10,908
  • 12
  • 46
  • 58
user2183216
  • 359
  • 3
  • 9
  • 22

3 Answers3

5

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

enter image description here

Wallack
  • 782
  • 4
  • 15
4

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...

JoDev
  • 6,633
  • 1
  • 22
  • 37
1

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

ForOhFor
  • 786
  • 10
  • 16