Martin Panter added the comment:
This seems to be as documented. Have a look at the definition of “base64_codec”
under
<https://docs.python.org/2/library/codecs.html#python-specific-encodings>,
which says “the result always includes a trailing '\n' ”. In fact, line breaks
are also added for longer encodings so that each line is ≤ 76 symbols.
>>> e.decode("base64")
'eyJ1c2VyTmFtZSI6ImFkbWluIiwicGFzc3dvcmQiOiJhZG1pbiJ9\n'
Your alternative encoding does not include that trailing newline. If you don’t
want the “MIME Base-64” multiline encoding maybe you should use something like
base64.b64encode() directly.
See also Issue 16473 where I proposed a patch to fix the Python 3 documentation
that links to the wrong equivalent function.
----------
nosy: +martin.panter
resolution: -> not a bug
status: open -> closed
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue25075>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com