I have the following string saved in a database: "cocotte & kekette
".
cocotte & kekette
" is displayed.
Can someone tell me how to fix this? Try either
html_entity_decode($string);
Or
mb_convert_encoding($string, "HTML-ENTITIES", "UTF-8");
That means you probably saved "cocotte & kekette" in the database to begin with. If not, you're double encoding your string.
The right path would be to save the data unencoded in the database. That not being possible, see the $double_encode
argument (set it to FALSE
) in htmlspecialchars
.
精彩评论