Another 2 to 3 mail encoding problem

Peter J. Holzer hjp-python at hjp.at
Mon Aug 31 18:28:38 EDT 2020


On 2020-08-27 09:34:47 +0100, Chris Green wrote:
> Peter J. Holzer <hjp-python at hjp.at> wrote:
> > The problem is that the message contains a '\ufeff' character (byte
> > order mark) where email/generator.py expects only ASCII characters.
> > 
> > I see two possible reasons for this:
[...]
> > Both reasons are weird.
[...]
> > But then you haven't shown where msg comes from. How do you parse the
> > message to get "msg"?
> > 
> > Can you construct a minimal test message which triggers the bug?
> > 
> Yes, simply sending myself an E-Mail with (for example) accented
> characters triggers the error.

Ok. So it's not a specific message, but any mail with accented
characters.

Since Python's mailbox module handles mails with accented characters
just fine (I've processed thousands of mails with it), the bug is almost
certainly in your program. And, as I explained above, almost certainly
in the part which you didn't show us.

Can you reduce your program to the minimum which still triggers the bug
and post the result here?

        hp

-- 
   _  | Peter J. Holzer    | Story must make more sense than reality.
|_|_) |                    |
| |   | hjp at hjp.at         |    -- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |       challenge!"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20200901/f4ddf20a/attachment.sig>


More information about the Python-list mailing list