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