Encode HTML CDATA name token

Gregor Horvath gh at gregor-horvath.com
Mon Sep 20 12:37:48 CEST 2010


Am Mon, 20 Sep 2010 21:36:46 +1200
schrieb Lawrence D'Oliveiro <ldo at geek-central.gen.new_zealand>:

> In message <20100920104546.3699e919 at valun>, Gregor Horvath wrote:
> 
> > Is there a encoder / decoder in Python that can convert arbitrary
> > text to and from this encoding in an readable manner?
> 
> Not sure if this is already in Python, but 
> <http://en.wikipedia.org/wiki/Base32>.

Thanks for the suggestion.

Yes it is in Python: base64.b32encode

2 Problems: 

a) "=" is used as padding char
b) The special case of a base32 encoding with a leading digit is not
handled.
c) It's not readbale

But I can easly work around this. 
Thanks.

--
Greg





More information about the Python-list mailing list