function characet($data){
if( !empty($data) ){
$fileType = mb_detect_encoding($data , array('ASCII','GBK','GB2312','UCS-2BE','UTF-8','LATIN1','BIG5')) ;
if( $fileType != 'UTF-8'){
$data = mb_convert_encoding($data ,'utf-8' , $fileType);
}
}
return $data;
}
注:uft-8 要在 LATIN1前面
网友评论