[Python-Dev] email header encoding
chris at simplistix.co.uk
Sat Apr 11 14:33:33 CEST 2009
Stephen J. Turnbull wrote:
> Robert Brewer writes:
> > Syntactically, there's no sense in providing:
> > Message.set_header('Subject', 'Some text', encoding='utf-16')
> > ...since you could more clearly write the same as:
> > Message.set_header('Subject', 'Some text'.encode('utf-16'))
> Which you now must *parse* and guess the encoding to determine how to
> RFC-2047-encode the binary mush. I think the encoding parameter is
> necessary here.
> > But it would be far easier to do all the encoding at once in an
> > output() or serialize() method. Do different headers need different
> > encodings?
> You can have multiple encodings within a single header (and a naïve
"can" and "should" are two very different things.
When is it even a good idea to have more than one encoding in a single
Simplistix - Content Management, Zope & Python Consulting
More information about the Python-Dev