homepage

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 terry.reedy
Recipients terry.reedy
Date 2008年11月22日.00:41:18
SpamBayes Score 9.079555e-05
Marked as misclassified No
Message-id <1227314479.85.0.870718938291.issue4387@psf.upfronthosting.co.za>
In-reply-to
Content
Binascii b2a_xxx functions accept 'binary data' and return ascii-encoded
bytes. The corresponding a2b_xxx functions turn the ascii-encoded bytes
back to 'binary data' (bytes). If the binary data is bytes, these
should be inverses of each other.
Somewhat surprisingly to me (because the corresponding base64 module
functions raise "TypeError: expected bytes, not str") 3.0 strings
(unicode) are accepted as 'binary data', though they will not 'round-trip'.
Ascii chars almost do
>>> a='aaaa'
>>> c=b.b2a_base64(a)
>>> c
b'YWFhYQ==\n'
>>> d=b.a2b_base64(c)
>>> d
b'aaaa'
But general unicode chars generate nonsense.
>>> a='\u1000'
>>> c=b.b2a_base64(a)
>>> c
b'4YCA\n'
>>> d=b.a2b_base64(c)
>>> d
b'\xe1\x80\x80'
I also tried b2a_uu.
Is this a bug?
History
Date User Action Args
2008年11月22日 00:41:20terry.reedysetrecipients: + terry.reedy
2008年11月22日 00:41:19terry.reedysetmessageid: <1227314479.85.0.870718938291.issue4387@psf.upfronthosting.co.za>
2008年11月22日 00:41:18terry.reedylinkissue4387 messages
2008年11月22日 00:41:18terry.reedycreate

AltStyle によって変換されたページ (->オリジナル) /