I have an email subject of the form:
=?utf-8?B?T3.....?=
The body of the email is utf-8 base64 encoded – and has decoded fine. I am current using Perl’s Email::MIME module to decode the email.
What is the meaning of the =?utf-8 delimiter and how do I extract information from this string?
The
encoded-wordtokens (as per RFC 2047) can occur in values of some headers. They are parsed as follows:Charset is UTF-8 in this case, the encoding is
Bwhich means base64 (the other option isQwhich means Quoted Printable).To read it, first decode the base64, then treat it as UTF-8 characters.
Also read the various Internet Mail RFCs for more detail, mainly RFC 2047.
Since you are using Perl, Encode::MIME::Header could be of use: