From: SourceForge.net <no...@so...> - 2007-05-19 17:27:38
|
Bugs item #634637, was opened at 2002-11-06 15:15 Message generated for change (Comment added) made by cgroves You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=112867&aid=634637&group_id=12867 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: Deferred >Status: Closed >Resolution: Fixed Priority: 4 Private: No Submitted By: Andrew Dalke (dalke) Assigned to: Nobody/Anonymous (nobody) Summary: base64/binascii difference from Python Initial Comment: 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 ---------------------------------------------------------------------- >Comment By: Charles Groves (cgroves) Date: 2007-05-19 12:27 Message: Logged In: YES user_id=1174327 Originator: NO Looks like this is fixed under 2.2b2. ---------------------------------------------------------------------- Comment By: leouser (leouserz) Date: 2007-01-15 12:35 Message: Logged In: YES user_id=1277399 Originator: NO oh yeah! This bug does not happen in jython3005. In fact, the output from jython is the same from python2.5: me% jython show_problem.py /p> <p> </p> </HTML> 1136apiV5-539kBeM6916ucuL2-386xXRe3337AvFG1-118bJnl47 me% python show_problem.py /p> <p> </p> </HTML> 1136apiV5-539kBeM6916ucuL2-386xXRe3337AvFG1-118bJnl47 and according to the bug report its supposed to be: 1136apiV5-539kBeM6916ucuL2-386xXRe3337AvFG1-118bJnl47 maybe this was a bug in one of the older python libraries and has subsequently been fixed by upgrading the library? ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=112867&aid=634637&group_id=12867 |