Python 3 how to convert a list of bytes objects to a list of strings?
Chris Green
cl at isbd.net
Fri Aug 28 08:44:54 EDT 2020
Stefan Ram <ram at zedat.fu-berlin.de> wrote:
> Chris Green <cl at isbd.net> writes:
> >Therein lies the problem, the incoming byte stream *isn't* ASCII, it's
> >an E-Mail message which may, for example, have UTF-8 or other encoded
> >characters in it. Hopefully it will have an encoding given in the
> >header but that's only if the sender is 'well behaved', one needs to
> >be able to handle almost anything and it must be done without 'manual'
> >interaction.
>
> I would make a difference between "scoring" and "transport":
>
> To transfer a message into an mbox it can be transferred as it is.
> Just the bytes from the POP3 server. Let mutt deal with them.
>
That's what I do at present in Python 2, the problem is that Python 3
complains when I use the standard library to put the message into the
mbox.
I want to transport the message into my mbox and Python 3 won't do it
without knowing how it's encoded whereas Python 2 just stuffed it in
there 'as is'.
I want Python 3's mailbox class to juyst put what I tell it (even if
mis-formatted or mis-encoded) into the mbox.
--
Chris Green
ยท
More information about the Python-list
mailing list