...
|
...
|
@@ -38,21 +38,14 @@ class MailFun { |
|
|
*/
|
|
|
public static function mb_coding(string $str,array $appcode=[]){
|
|
|
$str = trim($str," \t\n\r");
|
|
|
preg_match("/^=\?(.*)\?/U",$str,$code);
|
|
|
$str = (new Header())->decode($str);
|
|
|
// if(str_starts_with($str, '=?')){
|
|
|
// try {
|
|
|
// $encode = @mb_detect_encoding($str, array_merge(array("ASCII",'UTF-8',"GB2312","GBK",'BIG5'),$appcode));
|
|
|
// if($encode){
|
|
|
// return @mb_convert_encoding($str, 'UTF-8', $encode);
|
|
|
// }
|
|
|
// }catch (\Throwable $e){
|
|
|
//
|
|
|
// }
|
|
|
// }
|
|
|
if(($code[1]??'utf-8') != 'utf-8'){
|
|
|
$str = mb_convert_encoding($str, 'UTF-8', $code[1]);
|
|
|
}
|
|
|
try {
|
|
|
$encode = mb_detect_encoding($str, array("ASCII",'UTF-8',"GB2312","GBK",'BIG5'));
|
|
|
if($encode && $encode != 'UTF-8'){
|
|
|
$str = mb_convert_encoding($str, 'UTF-8', $encode);
|
|
|
}
|
|
|
}catch (\Throwable $e){}
|
|
|
|
|
|
|
|
|
return $str;
|
|
|
}
|
...
|
...
|
|