Phpcms采集时出现编码转化错误的解决方法
Phpcms采集时出现编码转化错误的解决方法
发布时间:2016-12-23 来源:查字典编辑
摘要:phpcms在本地测试正常传到虚拟主机上采集的时候出现这个错误Warning:mb_convert_encoding()[function....

phpcms在本地测试正常 传到虚拟主机上采集的时候出现这个错误

Warning: mb_convert_encoding() [function.mb-convert-encoding]: Unknown encoding ”UTF-8//IGNORE”

看了半天源码,发现是phpcms编码转化的BUG,修改步骤如下:

打开phpcmslibsfunctionsglobal.func.php文件

找到

/**

* iconv 编辑转换

*/

修改代码,红色的那一句

/**

* iconv 编辑转换

*/

if (!function_exists('iconv')) {

function iconv($in_charset, $out_charset, $str) {

$in_charset = strtoupper($in_charset);

$out_charset = strtoupper($out_charset);

if (function_exists('mb_convert_encoding')) {

return mb_convert_encoding($str, str_replace('//IGNORE','',$out_charset), str_replace('//IGNORE','',$in_charset));

} else {

pc_base::load_sys_func('iconv');

$in_charset = strtoupper($in_charset);

$out_charset = strtoupper($out_charset);

if ($in_charset == 'UTF-8' && ($out_charset == 'GBK' || $out_charset == 'GB2312')) {

return utf8_to_gbk($str);

}

if (($in_charset == 'GBK' || $in_charset == 'GB2312') && $out_charset == 'UTF-8') {

return gbk_to_utf8($str);

}

return $str;

}

}

}

这样就能解决问题了。

推荐文章
猜你喜欢
附近的人在看
推荐阅读
拓展阅读
相关阅读
网友关注
最新phpcms学习
热门phpcms学习
CMS教程子分类