REPOST: Re: base64.decodestring gives binascii.error

Alex Martelli aleax at aleax.it
Fri Dec 28 11:42:47 EST 2001


"Erik Myllymaki" <erik at pacific-shores.com> wrote in message
news:3C2C9D79.9050501 at pacific-shores.com...
> The '_' and '!' were in the original string that was then encoded, not
> in the resulting encoded string.

Then, it's clearly a bug in the base64 module you're using.  I
don't see it here:

>>> x=base64.encodestring('oh_my!')
>>> x
'b2hfbXkh\n'
>>> base64.decodestring(x)
'oh_my!'
>>>


[original context was -- oh those hateful add-in-front habits!:

> >>should base64.decodestring give a binascii.error if it encounters
> >>special chars like '_' and '!' ?
> >
> > Makes sense to me; after all, such characters should never be
> > in a string produced by base64, so the data must have been
> > damaged in transit -- raising an exceptions seems appropriate.

]


Alex

========= WAS CANCELLED BY =======:
Path: news.sol.net!spool0-milwwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!news.tele.dk!small.news.tele.dk!134.75.7.11!nntp.kreonet.re.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r
From: "Alex Martelli" <aleax at aleax.it>
Newsgroups: comp.lang.python
Subject: cmsg cancel <a0i7e6$2td$1 at serv1.iunet.it>
Control: cancel <a0i7e6$2td$1 at serv1.iunet.it>
Date: Mon, 31 Dec 2001 02:09:17 GMT
Organization: A poorly-installed InterNetNews site
Lines: 2
Message-ID: <cancel.a0i7e6$2td$1 at serv1.iunet.it>
NNTP-Posting-Host: 211.57.49.2
X-Trace: news2.kornet.net 1009775207 27193 211.57.49.2 (31 Dec 2001 05:06:47 GMT)
X-Complaints-To: usenet at news2.kornet.net
NNTP-Posting-Date: Mon, 31 Dec 2001 05:06:47 +0000 (UTC)
X-No-Archive: yes
X-Unac4ncel: yes
X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999)

This message was cancelled from within Mozilla.



More information about the Python-list mailing list