On Tue, 06 Oct 2009 06:33:37 -0700, Maxim Kuleshov wrote: > How should I correctly construct internationalized base64'ed MIME > header? > The problem is that 'real name' _should_ be encoded, but the email > address - should not. > For example, ?utf-8?bla-bla=?= <em...@domain> should be the correct > format, and > ?utf-8?bla-bla-bla-bla=?= - incorrect.
from email.header import Header, decode_header h = Header() h.append("Real Name", 'utf-8') h.append(" <em...@domain>") h.encode() '=?utf-8?q?Real_Name?= <em...@domain>' decode_header(_) [('Real Name', 'utf-8'), ('<em...@domain>', None)] -- http://mail.python.org/mailman/listinfo/python-list