[Email-SIG] [Python-Dev] Dropping bytes "support" in json

Barry Warsaw barry at python.org
Mon Apr 13 16:20:19 CEST 2009


On Apr 10, 2009, at 3:22 PM, 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.

Agreed!  In fact, it's redundant to explicitly encode the string.  So  
the first spelling is preferred.

>> 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
> algorithm might very well encode "The price of Gödel-Escher-Bach is
> €25" as "The price of =?ISO-8859-1?Q?G=F6del-Escher-Bach?= is
> =?ISO-8859-15?Q?=A425?=").

Isn't email just wonderful?  Please, spam and Facebook, kill it off  
once and for all, won't you?

-Barry

-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 304 bytes
Desc: This is a digitally signed message part
URL: <http://mail.python.org/pipermail/email-sig/attachments/20090413/28d10517/attachment-0001.pgp>


More information about the Email-SIG mailing list