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

Hi,

We are also having problem with utf-8 characters only in subject. Message is okay.

Header shows like this:

Subject: =?iso-8859-2?B?ufC58Lnwvua+5r7m?=

our osticket is version 1.7.3 and we do not have class.mailfetch.php

Any idea how to solve this?

There is no such thing as v1.7.3 you must mean 1.5.3 in which case you should upgrade, much of the mail handling and several security issues, etc. have been fixed since that version. 1.5.3 is extremely out of date.

You are right.

I confused it with Eticket: http://www.eticketsupport.com(http://www.eticketsupport.com)

Why?

because this two softwares look similar and when you search on google, you find pages from os ticket : )

Is there something in common for this two softwares?

Very interesting that this error is the same.

Hi,

We switched to OSTICKET. It is much better. But problem is the same as with eticket regarding utf-8 in subject.

How you view headers in osticket? There is no such option like in eticket, or there is?

Replace this:

function mime_decode($text) {

$a = imap_mime_header_decode($text);

$str = '';

foreach ($a as $k => $part)

$str.= $part->text;

return $str?$str($text);

}

With above.

Works Perfect, thank you!!!!

Write a Reply...