html_entity_decode problem in PHP?

泪湿孤枕 提交于 2019-11-30 04:51:10

– maps to a UTF-8 character (the em dash) so you need to specify UTF-8 as the character encoding:

$converted = html_entity_decode($string, ENT_COMPAT, 'UTF-8');

Try using charset

<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> 
<?php
$string = "Hello &#8211; World";
$converted = html_entity_decode($string , ENT_COMPAT, 'UTF-8');
echo $converted;
?>

This should work And it should be converted also in the source

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!