Skip to content Skip to sidebar Skip to footer

PHP Function To Convert From Html Codes To Normal Chars

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function should I use to convert the ’ to the actual 'normal' char ': La Torre Eif

Solution 1:

html_entity_decode. From the php.net manual: html_entity_decode() is the opposite of htmlentities() in that it converts all HTML entities in the string to their applicable characters.


Solution 2:

try this

echo html_entity_decode('La Torre Eiffel paragonata all’Everest',ENT_QUOTES,'UTF-8');

so in your code change this

 $output = curl_download($my_url);
 $output = htmlspecialchars_decode($output);

to

$output = curl_download($my_url);
$output = html_entity_decode($output,ENT_QUOTES,'UTF-8');

Post a Comment for "PHP Function To Convert From Html Codes To Normal Chars"