Re: gmail IMAP extensions are returned as MIME encoded-words

Charles Cazabon <[email protected]> Thu, 31 Dec 2020 11:08:40 -0600
Newsgroups gmane.mail.getmail.user
Message-ID <[email protected]>
Dave Jagoda <[email protected]> wrote:
> Using getmail 5.15 to fetch messages with Google's IMAP extensions
> currently returns data like this:
> 
> X-GMAIL-LABELS: =?utf-8?b?IlxcU2VudCIgJlRnQS0gJlZNRS0gc3lzdCZBT2ctbWVz?=
> X-GMAIL-THRID: =?utf-8?q?1234567890123456789?=
> X-GMAIL-MSGID: =?utf-8?q?1234567890123456789?=

Those look correct to me.  Keep in mind that mail headers are limited to 7-bit
ASCII characters (RFC2047), even if the body is not.

Any MUA you're reading the message with should recognize the RFC2047-format
header encoding above and display it to you as proper unicode characters.

> to this:
>     msg.add_header(header, unicode(value))
> 
> Makes the output more closely match what you see using IMAP directly:
> 
> X-GMAIL-LABELS: "\\Sent" &TgA- &VME- syst&AOg-mes

That's incorrect.  The code and its output is correct as-is.  If your MUA
isn't displaying the values correctly, please file a bug for your MUA.

Charles
-- 
-----------------------------------------------------------------------
Charles Cazabon
GPL'ed software available at:               http://pyropus.ca/software/
-----------------------------------------------------------------------