解决获取章节报错iconv():detected an illegal character in input string

lsp123   ·   发表于 9个月前   ·   技术交流

缓存章节到本地发现的,转换编码错误。解决方法:


\extend\net\Gather.php 文件找到并改成

//自动编码转换    

static public function auto_convert2utf8($str,$encode) {        

        if(empty($encode) || $encode=='auto'){

            $encode = mb_detect_encoding($str, array('ASCII', 'UTF-8', 'GB2312', 'GBK', 'BIG5'));

        }

        if (strcasecmp($encode, 'utf-8') !== 0) {

            try {

                $str = iconv($encode, 'utf-8//IGNORE', $str);

            }catch (\Exception $e) {

                $str = mb_convert_encoding($str, 'utf-8', $encode);

            }

                    }

        return $str;    

}


0 条回复   |  直到 9个月前 | 135 次浏览
登录后才可发表内容