Author manlioperillo
Date 2006-09-10.16:04:26
SpamBayes Score
Marked as misclassified
The support for Unicode strings in the email package
(notably MIMEText and Header class) is not uniform.

The behaviour with Unicode strings in Header is
documented but the interface is not good.

This code works, but it should not:

>>> h = Header.Header(u"àèìòù", charset="us-ascii")
>>> m = Message.Message()
>>> m["Subject"] = h
>>> print m.as_string()

Allowing this to work can cause confusion, I'm saying
that the charset is us-ascii, not utf-8.

With MIMEText I obtain:

m = MIMEText.MIMEText(u"àèìòù", _charset="us-ascii")
>>> print m.as_string()

[ exception ]

I think that the correct behaviour (for all functions
accepting strings) is:

- Do not accept plain str strings (8-bit).
  Accept only if they are plain ascii (7-bit).
- The charset specified should not be considered an 
  hint, but the charset I want to be used.

Regards  Manlio Perillo
Date User Action Args
2007-08-23 14:42:35adminlinkissue1555842 messages
2007-08-23 14:42:35admincreate