爬去网页数据 html文档编码问题
$code=mb_check_encoding($res);//检测编码
$res = mb_convert_encoding($res,'utf8',$code);//转换编码,方法一
$res = iconv("GB2312","UTF-8",$res);//转换编码,方法二
当用方法一的时候,输出来依然是乱码,用方法二 可正常输出
res=mbconvertencoding(
res,’utf8’,‘gb312’);
也可转换成功,输出正常,但是没有 iconv效率高;