Message789

Author dalke
Recipients
Date 2002-11-06.20:15:27
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
A poorly formatted base64-encoded email I received ends
with
something like

L3A+DQo8cD4gPC9wPg0KPC9IVE1MPg0KMTEzNmFwaVY1LTUzOWtCZU02OTE2
dWN1TDItMzg2eFhSZTMzMzdBdkZHMS0xMThiSm5sNDc=
_______________________________________________
<footer>

Under Python this is turned into

[dalke@zebulon ~/tmp]$ python show_problem.py
/p>
<p> </p>
</HTML>
1136apiV5-539kBeM6916ucuL2-386xXRe3337AvFG1-118bJnl47
[dalke@zebulon ~/tmp]$

Under Jython this raises an exception

[dalke@zebulon ~/tmp]$ jython show_problem.py
Traceback (innermost last):
  File "show_problem.py", line 10, in ?
  File "/home/dalke/jython-2.1/Lib/base64.py", line 47,
in decodestring
  File "/home/dalke/jython-2.1/Lib/base64.py", line 31,
in decode
binascii.Error: Incorrect padding
[dalke@zebulon ~/tmp]$


Here is the "show_problem.py" script

import base64

s = (
    "L3A+DQo8cD4gPC9wPg0KPC9IVE1MPg0K"
    "MTEzNmFwaVY1LTUzOWtCZU02OTE2\n"
    "dWN1TDItMzg2eFhSZTMzMzdBdkZHMS0xMThiSm5sNDc=\n"
    "_______________________________________________\n"
    "<footer>\n"
    )

print base64.decodestring(s)

I could find no discussion of this on the newsgroups nor
in the bug lists for Python nor Jython.

I'll let you all and the CPython people decide on which
implementation is at fault or not :)

                                              Andrew
History
Date User Action Args
2008-02-20 17:17:11adminlinkissue634637 messages
2008-02-20 17:17:11admincreate