[issue17946] base64 encoding result should be str, not bytes

Lucas Clemente Vella report at bugs.python.org
Thu May 9 20:05:16 CEST 2013


New submission from Lucas Clemente Vella:

As stated in RFC 3548:

   Base encoding of data is used in many situations to store or transfer
   data in environments that, perhaps for legacy reasons, are restricted
   to only US-ASCII [9] data.

thus, I was surprised to see, when I used base64 for the first time in python 3, that the encodig result was bytes, not str. Well, if I am encoding something to base64, I am most certainly needing it as a printable ASCII string, not as an binary byte array.

Thus, I suggest that the output of:
   base64.b64encode(data)
to be, instead, the output of:
   base64.b64encode(data).decode('ascii')

----------
components: Library (Lib)
messages: 188786
nosy: Lucas.Vella
priority: normal
severity: normal
status: open
title: base64 encoding result should be str, not bytes
type: enhancement
versions: Python 3.3

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue17946>
_______________________________________


More information about the Python-bugs-list mailing list