From: <bc...@wo...> - 2001-05-29 19:17:37
|
[Chris Meyers] >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? The binascii module contains two function that deals with base64. Jython 2.0 on java1.3.0 (JIT: null) Type "copyright", "credits" or "license" for more information. >>> import binascii >>> dir(binascii) ['Error', 'Incomplete', '__doc__', 'a2b_base64', 'a2b_hex', 'a2b_hex$doc', 'a2b_ hqx', 'a2b_uu', 'b2a_base64', 'b2a_hex', 'b2a_hqx', 'b2a_uu', 'crc32', 'crc_hqx' , 'hexlify', 'rlecode_hqx', 'rledecode_hqx', 'unhexlify'] >>> print binascii.b2a_base64("hello world") aGVsbG8gd29ybGQ= >>> print binascii.a2b_base64(binascii.b2a_base64("hello world")) hello world >>> regards, finn |