[issue4329] base64 does not properly handle unicode strings
STINNER Victor
report at bugs.python.org
Sat Nov 22 00:07:03 CET 2008
STINNER Victor <victor.stinner at haypocalc.com> added the comment:
It's not a bug. base64 is a codec to encode *bytes* and characters.
You have to encode your unicode string to bytes using a charset
Example (utf-8):
>>> from base64 import b64encode, b64decode
>>> b64encode(u'a\xe9'.encode("utf-8"))
'YcOp'
>>> unicode(b64decode('YcOp'), "utf-8")
u'a\xe9'
----------
nosy: +haypo
resolution: -> fixed
status: open -> closed
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue4329>
_______________________________________
More information about the Python-bugs-list
mailing list