adixon has asked for the wisdom of the Perl Monks concerning the following question:

Have been processing emails via perl for quite sometime, the device which has been creating the emails (with attachments) had a firmware upgrade; since this occurred the From:, To: and Subject: lines have had character encoding on them;
Subject: =?ISO-8859-1?B?U2Nhbm5lZCBmcm9tIGVTNDUx?= =?ISO-8859-1?B?MS1taWRkbGUgMDgvMTYvMjAw?= =?ISO-8859-1?B?NSAxNjowMQ==?=
Including the newline on the subject... It reads fine in any email client however I am unable to convert this to plaintext the way it was. As I need to extract information from the subject.
I have tried numerous suggestions from sites on the internet; http://www.infocopter.com/perl/utf-8.htm for example. Which just spitout exactly the same 'garble' instead of the plaintext.
Anyone have any idea as to how I can convert this into plain ascii text.

Thanks

Replies are listed 'Best First'.
Re: ISO-8859-1 to plain text conversion
by Bob9000 (Scribe) on Aug 17, 2005 at 06:50 UTC

    ISO-8859-1 is plain text. The problem is that the header data has been encoded in Base64, and encapsulated as per RFC 1522. The easiest way to undo it would probably be something like:

    use MIME::Words qw(:all); $header = decode_mimewords($raw_header);