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 mbecker, terry.reedy, vstinner
Date 2008-11-21.23:30:45
SpamBayes Score 8.12217e-08
Marked as misclassified No
Message-id <1227310246.98.0.860632190695.issue4329@psf.upfronthosting.co.za>
In-reply-to
Content
"This module provides data encoding and decoding as specified in RFC
3548. This standard defines the Base16, Base32, and Base64 algorithms
for encoding and decoding arbitrary binary strings into text strings
that can be safely sent by email, used as parts of URLs, or included as
part of an HTTP POST request. "

In other words, arbitrary 8-bit byte strings <=> 'safe' byte strings
You have to encode unicode to bytes first, as you did.  Str works
because you only have ascii chars and str uses the ascii encoder by
default.  The bytes() constructor has no default and 'ascii' must be
supplied

The error message is correct even if backwards. Unicode.translate
requires a unicode mapping, whereas b64decode supplies a bytes mapping
because it requires bytes.

3.0 added an earlier type check, so the same code gives
TypeError: expected bytes, not str

I believe there was an explicit decision to leave low-level wire-
protocol byte functions as bytes/bytearray only.

The 3.0 manual needs updating in this respect, but I will start another
issue for that.
History
Date User Action Args
2008-11-21 23:30:47terry.reedysetrecipients: + terry.reedy, vstinner, mbecker
2008-11-21 23:30:46terry.reedysetmessageid: <1227310246.98.0.860632190695.issue4329@psf.upfronthosting.co.za>
2008-11-21 23:30:46terry.reedylinkissue4329 messages
2008-11-21 23:30:45terry.reedycreate