Is there any way to make sense of these E-Mail subjects?
Chris Green
cl at isbd.net
Fri Dec 24 12:18:06 EST 2021
Python <python at example.invalid> wrote:
> Chris Green wrote:
> > Subject: [SPAM] =?UTF-8?B?8J+TtyBKb2huIEJheHRlci1C?=
> > =?UTF-8?B?cm93biByZWNlbnRseSBw?=
> > =?UTF-8?B?b3N0ZWQgYSBuZXcgcGhv?=
> > =?UTF-8?B?dG8=?=
> >
> > It looks like some sort of mis-encoding of UTF-8 strings, can anyone
> > suggest what might be going on and/or a way to get some sense out of
> > this?
>
> It's not mis-encoding, it the standard way to embed non-ascii
> characters in the header. ?UTF-8?B? means base64 encoded utf-8,
> then the content is on multiple lines:
>
> $ base64 -d < t
> 📷 John Baxter-Brown recently posted a new photo
>
> email.header.decode_header should be able to handle it.
>
Brilliant, thank you, just what I needed to know.
--
Chris Green
·
More information about the Python-list
mailing list