This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author martin.panter
Recipients Ramin Farajpour Cami, martin.panter
Date 2015-09-12.00:19:47
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1442017189.25.0.10914597955.issue25075@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2015-09-12 00:19:49martin.pantersetrecipients: + martin.panter, Ramin Farajpour Cami
2015-09-12 00:19:49martin.pantersetmessageid: <1442017189.25.0.10914597955.issue25075@psf.upfronthosting.co.za>
2015-09-12 00:19:48martin.panterlinkissue25075 messages
2015-09-12 00:19:47martin.pantercreate