[Python-3000] base64 - bytes and strings

Greg Ewing greg.ewing at canterbury.ac.nz
Tue Jul 31 03:33:43 CEST 2007


Terry Reedy wrote:
> On the contrary, to me, the point of base64 is to encode bytes into a 
> subset of bytes more or less guaranteed to not get mangled during 
> transport.

Yes, and the way it goes about it is to map the binary
data to a sequence of characters, the reasoning being
that most such channels can at least encode those characters
somehow, because they're designed for the purpose of sending
text.

> That these safe bytes correspond to ascii chars

They only correspond to ASCII character *codes* when the
channel in question is designed to transmit text encoded
in ASCII. If the channel were designed to transmit text
encoded in EBCDIC or some other way, then ASCII codes would
likely get mangled just as badly as raw binary data.

--
Greg


More information about the Python-3000 mailing list