Thursday, 15 August 2013

Why does html entities function not properly work?

I tried the htmlentities() function with PHP 5 with this code:
 $string="Einst├╝rzende Neubauten"; echo htmlentities($string);
And it only displays two whitespaces (i.e. " "). Why is that? I tried to replace the "u with diaeresis" char with another and it works. How can i get that work too?


use charset for your given content to .... eg
 $res = htmlentities ( $string, ENT_COMPAT, 'UTF-8');
For more informations take a look in the manual htmlentities()



Post a Comment