检查目标编码是否为UTF-8
,不是的话转为UTF-8
$targetEncoding = 'UTF-8';
$encoding = mb_detect_encoding($client->body, array("ASCII", "UTF-8", "GB2312", "GBK", "BIG5"));
if ($encoding != $targetEncoding) {
$str = mb_convert_encoding($client->body, $targetEncoding, $encoding);
}