By Anna on Thursday, 03 March 2016
Posted in Technical Issues
Likes 0
Views 680
Votes 0
Hi,

when posting an article via eMail we observed, that longer subjects which are encoded in our standard ISO-8859-1 encoding are cut off.

So
'Wie ist der aktuelle Ablauf für die Installation einer Datenbank bei einem Neukunden?'
in the email subject will result in
'Wie ist der aktuelle Ablauf für die Installation einer'
as Article Question

When having a look at the mailbox.php class the reason seems obvious:
$headerOfValue = imap_mime_header_decode($value);
$header = $headerOfValue[0];
So for the subject header the imap_mime_header_decode function returns an array - and you are only using the first object.

This is the entire value of the subject
=?ISO-8859-1?Q?Wie_ist_der_aktuelle_Ablauf_f=FCr_die_Installation_einer?= =?ISO-8859-1?Q?_Datenbank_bei_einem_Neukunden=3F?=

Resulting in only one stdClass Object in the header variable
( [charset] => ISO-8859-1
[text] => Wie ist der aktuelle Ablauf für die Installation einer
)

Please fix.

Thanks,

Anna
Ok, I helped myself and changed the foreach loop in mailbox.php like this, maybe you want to include something similar:

// decode headers
foreach($headers as $key => $value)
{
if (!is_array($value))
{
$header = imap_mime_header_decode($value);
$myText = '';
foreach ($header as $oneObject) {
$oneObject->charset = strtoupper($oneObject->charset);
if ($oneObject->charset != 'DEFAULT' && $oneObject->charset != 'UTF-8')
{
$oneObject->text = iconv($oneObject->charset, 'UTF-8', $oneObject->text);
}
$myText .= $oneObject->text;
}

$headers->$key = $myText;
}
}
·
Thursday, 03 March 2016 15:58
·
0 Likes
·
0 Votes
·
0 Comments
·
Thanks for sharing Anna
·
Thursday, 03 March 2016 17:13
·
0 Likes
·
0 Votes
·
0 Comments
·
You are welcome
·
Friday, 04 March 2016 01:06
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post