You need to specify the encoding for the htmlentities
function (here UTF-8):
$formdesc = htmlentities($_POST['formdesc'], ENT_QUOTES, 'UTF-8');
Otherwise the default value ISO-8859-1
is used and the character é
in your example encoded in UTF-8 as 0xC3A9 would be interpreted as two characters (Ã
and ©
).
But why do you use htmlentities
anyway? If you just want to escape the HTML special characters like &
, <
, >
, "
and '
htmlspecialchars
will suffice.
Gumbo
2009-06-30 07:23:47