0

I have following sample PHP to print special characters in output. But its not printing any special character.

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
    <?php
    $string = "½ Kg";
    ?>

Outputs:

<p>� Kg</p>

I have tried htmlspecialchars() or htmlentities() which is also not helping !!

Then tried setting header inside php.

header('Content-Type: text/html; charset=utf-8');

it says,

Warning: Cannot modify header information - headers already sent

kindly suggest how to print Special Characters

logan
  • 7,946
  • 36
  • 114
  • 185

0 Answers0