Python 3 how to convert a list of bytes objects to a list of strings?

Chris Green cl at isbd.net
Fri Aug 28 09:05:58 EDT 2020


Chris Angelico <rosuav at gmail.com> wrote:
> 
> Also, if you're parsing an email message, you can and should be doing
> so with respect to the encoding(s) stipulated in the headers, after
> which you will have valid Unicode text.
> 
But not all E-Mail messages are 'well behaved', the above works fine
if the headers specify the correct text encoding but quite often one
will get messages with no encoding specified and also one gets
messages with the wrong encoding specified.  One needs a way to handle
these 'rogue' messages such that most of the characters come out right.

-- 
Chris Green
·


More information about the Python-list mailing list