Terry J. Reedy <tjre...@udel.edu> added the comment:

Questions should generally be asked on python-list or its mirrors.

The docs do not say that the result should be exactly, byte-for-byte, the same. 
base64 module refers to RFC 3548. Both our doc and the RFC describe variations. 
The base64 codec does 'Mime base64' (7.8.3. Standard Encodings). The RFC says 
things like "MIME does not define "base 64" per se, but rather a "base 64 
Content-Transfer-Encoding" for use within MIME." It also mentions 'line-break 
issues'.

You neglected to identify and post what the difference is ;-).

>>> import base64
>>> s='I am a string'
>>> s.encode('base64')
'SSBhbSBhIHN0cmluZw==\n'
>>> base64.b64encode(s)
'SSBhbSBhIHN0cmluZw=='
>>> s.encode('base64')== base64.b64encode(s)+'\n'
True

The addition of '\n' for the Mime version looks to be intentional, and will not 
be changed for 2.7.

(2.5 and 2.6 only get security patches now.)

----------
nosy: +terry.reedy
resolution:  -> invalid
status: open -> closed
versions:  -Python 2.5, Python 2.6

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue10970>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to