If you don’t know the encoding format of the string, you can check this character like this:
$encode = mb_detect_encoding($string, array("ASCII",'UTF-8′,"GB2312′," GBK",'BIG5′));
echo $encode;
This way you can know what encoding it is. You can also transcode it in subsequent operations:
if ($encode = = “UTF-8″){
$string = iconv("UTF-8″,"GBK",$string);
}