iconv () 错误Detected an illegal character in input string iconv()

Detected an illegal character in input string iconv()

 

1. 第一种方案:

$a = iconv( 'UTF-8', 'UTF-8//TRANSLIT', $a );

$b = iconv( 'UTF-8', 'UTF-8//TRANSLIT', $b );

 

2.第二种方案:

//转码

function iconv_gbk_to_uft8($string){

 

if (!$string){

return '';

}

 

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

 

return iconv($encode, "UTF-8",$string);

}

 

或者:

// $fileName = iconv("utf-8", "gb2312", $fileName);

    $fileName = iconv("utf-8", "gbk", $fileName);

 

 

文章来源:刘俊涛的博客 欢迎关注公众号、留言、评论,一起学习。

__________________________________________________________________________________

若有帮助到您,欢迎点击推荐,您的支持是对我坚持最好的肯定(*^_^*)

posted @ 2021-05-27 10:38  刘俊涛的博客  阅读(421)  评论(0编辑  收藏  举报