...
|
...
|
@@ -21,10 +21,7 @@ class Fun { |
|
|
*/
|
|
|
public static function mb_convert_encoding($str, $to, $from = null){
|
|
|
|
|
|
// 这个好像是阿拉伯编码
|
|
|
if($from == 'iso-8859-8-i'){
|
|
|
$from = 'iso-8859-8';
|
|
|
}
|
|
|
$from = self::getEncodingAliases($from);
|
|
|
|
|
|
|
|
|
try {
|
...
|
...
|
@@ -35,4 +32,28 @@ class Fun { |
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 只有发现一个处理一个
|
|
|
* 获取编码
|
|
|
* @author:dc
|
|
|
* @time 2024/10/25 17:24
|
|
|
*/
|
|
|
public static function getEncodingAliases($coding){
|
|
|
$alias = [
|
|
|
"iso-8859-8-i" => "ISO-8859-8",
|
|
|
"iso-8859-8-e" => "ISO-8859-8",
|
|
|
"iso-8859-6-i" => "ISO-8859-6",
|
|
|
"iso-8859-6-e" => "ISO-8859-6",
|
|
|
];
|
|
|
|
|
|
$coding = strtolower($coding);
|
|
|
if(isset($alias[$coding])){
|
|
|
return $alias[$coding];
|
|
|
}
|
|
|
|
|
|
return $coding;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
} |
|
|
\ No newline at end of file |
...
|
...
|
|