Re: [Python-Dev] Dropping bytes "support" in json
Barry Warsaw <[email protected]>
| Newsgroups | gmane.comp.python.mime.devel |
|---|---|
| Message-ID | <[email protected]> |
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
PGP.sig
(application/pgp-signature, 304 B) - not displayed