-1

Accented characters weren't displaying in PHP so I added header('Content-Type: text/html; charset=UTF-8'); to the header. Still no joy. But I've solved it:

<!DOCTYPE html>
<html>
<head>
<?php
header('Content-Type: text/html; charset=UTF-8"');
?>
<meta http-equiv="Content-type" content="text/html" charset=utf-8" / >
</head>
<body>
  Hélène
</body>
</html>

Notice the difference?  Why should a single double quote before the final single quote make all the difference?
If I drop the php making an html file and insert a double quote before utf-8 in the meta tag the way it should be then it doesn't work!
I'm using Chrome Version 88.0.4324.150 (Official Build) (64-bit) - haven't tested with other browsers.

Any ideas?

TomF
  • 1
  • 1
  • 3
    This code doesn't work. You can't output a header after you already started outputting content. That also isn't valid syntax for the header. You should take a closer look at your testing as it does not appear to be valid. – John Conde Feb 26 '21 at 23:29
  • 1
    "Why should a single double quote before the final single quote make all the difference?" - Well, occasionally two wrongs do make a right. Deliberating which typo was recovered is off-topic however. – mario Feb 26 '21 at 23:35

1 Answers1

1

I don't understand your question, but in any case, you can always use <meta> tag from HTML5

<meta charset="utf-8">
nikitastrike
  • 101
  • 1
  • 8