tags:

views:

37

answers:

1

Hi all, I have a MIME-encoded messages (in Maildir), that are having both base64-encoded headers (solved by lurking for related question ( http://stackoverflow.com/questions/126070/decode-an-utf8-email-header ), decode('MIME-Header', $val), main body in plain text and a text/plain base64 encoded data in the body;

It is said, that base64 data is encoded in utf-8. However, when I do:

use MIME::Base4;
..
$decoded = decode_base64($block_from_line_array); # MIME body extracted from message's
$msgtext .= $decoded;
..
print decode('utf-8', $msgtext);

It seems that the block is decoded incorrectly.

print decode('utf-8', $msgtext); works ok, when message body is in utf-8

Attach:

X-Priority: 3
X-Mailer: PHPMailer (phpmailer.sourceforge.net) [version 2.0.4]
X-Mailer: http://www.we.praise.buggy.php.scripts.what.we.do.when.we.dont.do.us
X-MessageID: 140
MIME-Version: 1.0
Content-Type: multipart/alternative;
 boundary="b1_16819d4d69564bfc0185ed5b9508ad31"

<Here the body begins -- mhambra>
--b1_16819d4d69564bfc0185ed5b9508ad31
Content-Type: text/plain; charset = "utf-8"
Content-Transfer-Encoding: base64
<MIME BLOCK>

Message is known to be displayed correctly in GMail.