[Python-Dev] Mailbox module - timings and functionality changes (original) (raw)

Steve Holden steve at holdenweb.com
Wed Jun 30 02:31:59 CEST 2010


R. David Murray wrote:

On Tue, 29 Jun 2010 13:54:09 -0400, Steve Holden <steve at holdenweb.com> wrote:

A.M. Kuchling wrote:

But should mailboxes really be opened in a UTF-8 encoding, or should they be treated as 7-bit text? I'll have to think about this. Neither! You can't open them as 7-bit text, because real-world email does contain bytes whose ordinal value exceeds 127. You can't open them using a text encoding because theoretically there might be ASCII headers that indicate that parts of the content are in specific character sets or encodings.

If only we had a data structure that easily allowed us to manipulate 8-bit characters ... email6 will handle this use case. When it exists :) But note that it is not just a matter of easily handling 8 bit characters. There are a whole bunch of algorithms needed for interpreting that 7 and 8 bit data. All the info is there in the email headers, but being able to do string operations on 8 bit byte strings doesn't get you the answers you need by itself. It really is the case that the Python3 bytes/unicode split forces us to redo most of the algorithms so that they handle bytes and text correctly. This isn't a trivial undertaking, but the end result will be well worth it. I completely agree. The unusual thing here is that I of all people should find himself running into these issues, since my use of Python is normally pretty conservative. Since the course I am currently writing is already overdue I have to find answers now to problems that were present in the initial 3.0 release and have not received much attention since.

You know that I support your work to revise the email package. I hope that we can eventually have it incorporate mailbox readers as well.

regards Steve

Steve Holden +1 571 484 6266 +1 800 494 3119 See Python Video! http://python.mirocommunity.org/ Holden Web LLC http://www.holdenweb.com/ UPCOMING EVENTS: http://holdenweb.eventbrite.com/ "All I want for my birthday is another birthday" - Ian Dury, 1942-2000



More information about the Python-Dev mailing list