classification
Title: base64 not encode correctly
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.4
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: Hector Cloud, ezio.melotti
Priority: normal Keywords:

Created on 2015-06-10 09:56 by Hector Cloud, last changed 2015-06-10 10:02 by ezio.melotti. This issue is now closed.

Messages (2)
msg245123 - (view) Author: Hector Cloud (Hector Cloud) Date: 2015-06-10 09:56
I use Python 3.4.0 now. But its base64 encoding is not as expected.
----------------------------
import base64
ascii = base64.b64encode(u"YAU-interview-revised20120921".encode(), b'-_')
print(ascii)
----------------------------
The result is b'WUFVLWludGVydmlldy1yZXZpc2VkMjAxMjA5MjE='. There is a character '=' at the end which is not expected. In my opinion, the result should contain characters [A-Za-z0-9] and '-_'. The '=' should not be in the encoding result.

Is it a bug?
msg245124 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2015-06-10 10:02
No, this is expected.
See http://en.wikipedia.org/wiki/Base64#Padding
History
Date User Action Args
2015-06-10 10:02:59ezio.melottisetstatus: open -> closed

nosy: + ezio.melotti
messages: + msg245124

resolution: not a bug
stage: resolved
2015-06-10 09:56:19Hector Cloudcreate