Thursday 15 August 2013

Why does html entities function not properly work?


I tried the htmlentities() function with PHP 5 with this code:
<?php
 $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?




Anwer

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()

 

0 comments:

Post a Comment

CEX.io