[Python-3000] email libraries: use byte or unicode strings?

Barry Warsaw barry at python.org
Thu Nov 6 18:06:50 CET 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Nov 5, 2008, at 9:09 PM, Stephen J. Turnbull wrote:

> There need to be two (and I would say three is better) sets of APIs:
> byte-oriented for handling the wire protocol, Unicode-oriented for
> handling well-formed messages (both presentation and composition), and
> (probably) a "codec" layer which handles nastiness in the transition.
>
>> for the convenience of being abstracted away from the plethora of
>> encodings that are defined at the mail transport layer.
>
> But handling those is definitely in the domain of the email module.
> Any attachments of documents in legacy encodings will need to deal
> with them explicitly in composition of Content-Type headers, etc.

I think we can simplify this.  Almost all of the email-like wire  
protocol modules handle pure bytes.  nntplib, poplib, imaplib, even  
the http-based libraries iiuc.  That's as it should be.  Largely the  
email package should not be concerned with these, because the email  
package is all about the email-DOM, parsing raw "stuff" into it,  
manipulating it, and generating raw "stuff" out of it.

- -Barry

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Darwin)

iQCVAwUBSRMkKnEjvBPtnXfVAQJQ+wQAtm2FnphKbFSZFkpMrV9ALCwQZ78x8UpC
mFzU3lHZ786Wl6fM72kjVoNl+EdDWxR5ZPcDJ4j7EtMDers7431+MD3vTazaGiJP
M+uVxN6XRSSe2bhLeXbjcffHuDuefV2WZJjg50YCrpGY3s6LWcPOkUtf6AENVUFL
Wt5hG6nmFxQ=
=+LnA
-----END PGP SIGNATURE-----


More information about the Python-3000 mailing list