How can I convert input to HTML Characters correctly
Posted
by Codex73
on Stack Overflow
See other posts from Stack Overflow
or by Codex73
Published on 2010-04-03T14:44:13Z
Indexed on
2010/04/03
14:53 UTC
Read the original article
Hit count: 354
Let's say I'm including a file which contains html. The html have characters as exclamation symbols, Spanish accents (á, ó). The parsed included text gets processed as symbols instead of their correct value. This happens on FF but not on IE (8).
I have tried the following functions:
htmlspecialchars, htmlentities, utf8_encode
include htmlentities("cont/file.php");
Sample file.php contents:
<div>Canción, “Song Name”</div>
Output:
Canci?n, ?Song Name?
© Stack Overflow or respective owner