From: Robert W. B. <rb...@di...> - 2001-05-29 01:41:46
|
Hello Chris, On Mon, 28 May 2001, Chris Meyers wrote: > Is there a way to do base64 encoding in jython? We have an app where > python is base64 encoding data on the server side. On the client side we > are using jython, and we can't find a way to unencode it. Anyone out > there know of a way to do this? There is a Base64 module designed for this, but is only delivered with jython-2.1a1. I'm unaware of limitations in using Base64.py with Jython 2.0, so it's worth a try. If that doesn't pan out, using Jython-2.1a1 is reasonable as well- the 'alpha' doesn't mean unstable in this case. >>> import Base64 >>> s = "this is a test with some @wa%ck7y chara)c*te-=rs" >>> encoded = Base64.encodestring(s) >>> print encoded dGhpcyBpcyBhIHRlc3Qgd2l0aCBzb21lIEB3YSVjazd5IGNoYXJhKWMqdGUtPXJz >>> decoded = Base64.decodestring(encoded) >>> print decoded this is a test with some @wa%ck7y chara)c*te-=rs |