- Edited
Hi,
We had some problems with regional characters in the subject header of incomming emails.
A typical header could contain:
Subject: =?iso-8859-1?B?Neb45Q==?=
With osTicket v1.6 all subjects with regional characters was cut at the first regional character.
To fix this we replaced the function mime_decode in class.mailfetch.php with
function mb_list_lowerencodings() { $r=mb_list_encodings();
for ($n=sizeOf($r); $n--; ) { $r=strtolower($r); } return $r;
}
function mime_decode($mimeStr, $inputCharset='utf-8', $targetCharset='utf-8', $fallbackCharset='iso-8859-1') {
$encodings=$this->mb_list_lowerencodings();
$inputCharset=strtolower($inputCharset);
$targetCharset=strtolower($targetCharset);
$fallbackCharset=strtolower($fallbackCharset);
$decodedStr='';
$mimeStrs=imap_mime_header_decode($mimeStr);
for ($n=sizeOf($mimeStrs), $i=0; $i<$n; $i++) {
$mimeStr=$mimeStrs;
$mimeStr->charset=strtolower($mimeStr->charset);
if (($mimeStr == 'default' && $inputCharset == $targetCharset)
|| $mimStr->charset == $targetCharset) {
$decodedStr.=$mimStr->text;
} else {
$decodedStr.=mb_convert_encoding($mimeStr->text, $targetCharset, (in_array($mimeStr->charset, $encodings) ? $mimeStr->charset : $fallbackCharset) ) ;
}
} return $decodedStr;
}
Please feel free to add this change to v1.7.
Best regards,
Formosa