You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
foreach ($messages as $message) {
// $message is instance of \Ddeboer\Imap\Message
echo "\ngetting Message...";
echo "\n".$message->getSubject();
}
it breaks at a certain point...
getting Message...PHP Warning 'yii\base\ErrorException' with message 'mb_convert_encoding(): Unable to detect character encoding'
in /var/www/myhost.com/vendor/ddeboer/imap/src/Ddeboer/Imap/Message/Headers.php:20
// Decode subject, as it may be UTF-8 encoded
if (isset($headers->subject)) {
$subject = '';
foreach (\imap_mime_header_decode($headers->subject) as $part) {
// $part->charset can also be 'default', i.e. plain US-ASCII
$charset = $part->charset == 'default' ? 'auto' : $part->charset;
$subject .= \mb_convert_encoding($part->text, 'UTF-8', $charset);
}
$this->array['subject'] = $subject;
}
The text was updated successfully, but these errors were encountered:
Also, mb_convert_encoding breaks when unsupported encoding occurs, for instance, windows-1257. And there's no way to avoid code break. I suggest to do 2 things:
add workarounds for known unsupported encodings, may be for this purpose separate class could be created;
add fallback for other unexpected unsupported encodings: when source encoding isn't in mb_list_encodings, set it to auto.
On this code
$messages = $mailbox->getMessages();
it breaks at a certain point...
getting Message...PHP Warning 'yii\base\ErrorException' with message 'mb_convert_encoding(): Unable to detect character encoding'
in /var/www/myhost.com/vendor/ddeboer/imap/src/Ddeboer/Imap/Message/Headers.php:20
// Decode subject, as it may be UTF-8 encoded
The text was updated successfully, but these errors were encountered: