Function php convert string to UTF-8
conver string to Utf8 if String is not equals to 'UTF-8' /* *QQ: 290359552 * conver to Utf8 if $str is not equals to 'UTF-8'...
https://iskablogs.blogspot.com/2014/04/function-php-convert-string-to-utf-8.html
conver string to Utf8 if String is not equals to 'UTF-8'
/*
*QQ: 290359552
* conver to Utf8 if $str is not equals to 'UTF-8'
*/
function convToUtf8($str)
{
if( mb_detect_encoding($str,"UTF-8, ISO-8859-1, GBK")!="UTF-8" )
{
return iconv("gbk","utf-8",$str);
}
else
{
return $str;
}
}
/*
*QQ: 290359552
* conver to Utf8 if $str is not equals to 'UTF-8'
*/
function convToUtf8($str)
{
if( mb_detect_encoding($str,"UTF-8, ISO-8859-1, GBK")!="UTF-8" )
{
return iconv("gbk","utf-8",$str);
}
else
{
return $str;
}
}