[Python-3000] should rfc822 accept text io or binary io?

"Martin v. Löwis" martin at v.loewis.de
Sat Aug 18 07:50:33 CEST 2007


>>> What if you've got a PNG as one of the multipart components?  With a
>>> Content-Transfer-Encoding of "binary"?  There's no way to represent that
>>> as a string.
>> Sure is. Any byte sequence can be interpreted as latin-1.
> 
> Last time I looked, Latin-1 didn't cover the octets 0x80 - 0x9F.

Depends on where you looked. The IANA charset ISO_8859-1:1987 (MIBenum
4, alias latin1), defined in RFC 1345, has the C1 controls in this
place. Python's Latin-1 codec implements that specification, and when
Unicode says that the first 256 Unicode code points are identical
to Latin-1, they also refer to this definition of Latin-1.

If you look at section 1 of ISO 8859-1, you'll find that it can be used
with the coded control functions in ISO 6429. People typically assume
that it is indeed used in such a way, because you could not encode
line breaks otherwise (among other things).

> Maybe you're thinking of Microsoft codepage 1252?

Definitely not.

Regards,
Martin



More information about the Python-3000 mailing list