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

Stephen J. Turnbull stephen at xemacs.org
Fri Oct 31 07:23:14 CET 2008


Andrew McNamara writes:

 > However - charset encoding is part of the MIME spec, so users have a
 > reasonable expectation that the mime lib will present them with unicode.
 > So the API needs to be unicode.

It needs to /include/ unicode functionality.  However, this might very
well be lazy (a function which automatically resends a message may not
need to decode the MIME parts, for example).

So I think there should be three layers: one corresponding more or less
to raw SMTP---all bytes; one which handles mail as text---all unicode;
and one which handles the transitions---which needs phasers set to
"kill" any data in incorrect format.

I also suggest that these three levels of functionality are
intertwingled enough (at the RFC level) that it does not make sense to
separate them into more than one module.



More information about the Python-3000 mailing list