[Python-Dev] Why does base64 return bytes?

Greg Ewing greg.ewing at canterbury.ac.nz
Tue Jun 14 19:51:05 EDT 2016


R. David Murray wrote:
> The fundamental purpose of the base64 encoding is to take a series
> of arbitrary bytes and reversibly turn them into another series of
> bytes in which the eighth bit is not significant.

No, it's not. If that were its only purpose, it would be
called base128, and the RFC would describe it purely in
terms of bit patterns and not mention characters or
character sets at all.

The RFC does *not* do that. It describes the output in
terms of characters, and does not specify any bit patterns
for the output. The intention is clearly to represent
binary data as *text*.

-- 
Greg


More information about the Python-Dev mailing list