遇到乱码问题,弄了半天原来是语句iconv("cp1252","UTF-8",$content); 本身的问题
在参考了php.net的手册里的iconv函数后发现下面有人留言说iconv("cp1252","UTF-8",$content); 有点小毛病,http://php.oregonstate.edu/manual/en/function.iconv.php
可以用以下方法实现cp1252转成UTF-8的功能:
$content=htmlentities(file_get_contents($match_info_link), ENT_QUOTES, "Windows-1252");
$content=html_entity_decode($content, ENT_QUOTES , "utf-8");
本文介绍了如何解决从CP1252编码转换为UTF-8编码时出现的乱码问题,并提供了一种有效的方法:使用htmlentities结合html_entity_decode函数来实现正确的编码转换。
1824

被折叠的 条评论
为什么被折叠?



