From PHP 5.4 on, htmlentities()
and html_entity_decode()
are defaulting to 'UTF-8', which probably your data isn't (if it is coming from a database).
See this SO answer for more information.
Note: In that thread, it is just the other way around, so you need to convert your data to UTF-8 or tell the function to interpret your data as non-UTF-8).
$thetext = (html_entity_decode(htmlspecialchars_decode($row[kurztext], ENT_QUOTES), ENT_COMPAT | ENT_HTML401, "ISO-8859-1"));
Additionally, I think you should be able to work without htmlspecialchars_decode()
now, since html_entity_decode()
can also take care of the quotes via ENT_QUOTES
. Just add that additional flag to its parameters (I took the two currently used ones, since they are the PHP default values).