Message250504
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. |
|
Date |
User |
Action |
Args |
2015-09-12 00:19:49 | martin.panter | set | recipients:
+ martin.panter, Ramin Farajpour Cami |
2015-09-12 00:19:49 | martin.panter | set | messageid: <1442017189.25.0.10914597955.issue25075@psf.upfronthosting.co.za> |
2015-09-12 00:19:48 | martin.panter | link | issue25075 messages |
2015-09-12 00:19:47 | martin.panter | create | |
|