作者 邓超

1

@@ -51,7 +51,7 @@ class DeCoding { @@ -51,7 +51,7 @@ class DeCoding {
51 if (!($bEmulate_imap_8bit && ($i==count($aLines)-1))) 51 if (!($bEmulate_imap_8bit && ($i==count($aLines)-1)))
52 52
53 if (($iLastChar==0x09)||($iLastChar==0x20)) { 53 if (($iLastChar==0x09)||($iLastChar==0x20)) {
54 - $sLine{$iLength-1}='='; 54 + $sLine[$iLength-1]='=';
55 $sLine .= ($iLastChar==0x09)?'09':'20'; 55 $sLine .= ($iLastChar==0x09)?'09':'20';
56 } 56 }
57 } // imap_8bit encodes x20 before chr(13), too 57 } // imap_8bit encodes x20 before chr(13), too
@@ -26,36 +26,6 @@ class MailFun { @@ -26,36 +26,6 @@ class MailFun {
26 } 26 }
27 27
28 28
29 - /**  
30 - * 解码  
31 - * @param $string  
32 - * @param string $charset  
33 - * @return string  
34 - * @time 2022/8/15 9:31  
35 - */  
36 - public static function decodeMimeStr($string, $charset = 'utf-8') {  
37 - $newString = '';  
38 - $elements = \imap_mime_header_decode($string);  
39 -// print_r($elements);  
40 - for($i = 0; $i < count($elements); $i++) {  
41 - if($elements[$i]->charset == 'default') {  
42 - $elements[$i]->charset = 'iso-8859-1';  
43 - }  
44 - $newString .= self::convertStringEncoding($elements[$i]->text, $elements[$i]->charset, $charset);  
45 - }  
46 - return $newString;  
47 - }  
48 -  
49 - public static function convertStringEncoding($string, $fromEncoding, $toEncoding) {  
50 - $convertedString = null;  
51 - if($string && $fromEncoding != $toEncoding) {  
52 - $convertedString = @iconv($fromEncoding, $toEncoding . '//IGNORE', $string);  
53 - if(!$convertedString && extension_loaded('mbstring')) {  
54 - $convertedString = @mb_convert_encoding($string, $toEncoding, $fromEncoding);  
55 - }  
56 - }  
57 - return $convertedString ?: $string;  
58 - }  
59 29
60 30
61 /** 31 /**