html codes

Matt Nordhoff mnordhoff at mattnordhoff.com
Tue Dec 9 03:11:08 EST 2008


Daniel Fetchinson wrote:
> Hi folks,
> 
> I came across a javascript library that returns all sorts of html
> codes in the cookies it sets and I need my web framework (written in
> python :)) to decode them. I'm aware of htmlentitydefs but
> htmlentitydefs.entitydefs.keys( ) are of the form '&#xxx' but this
> javascript library uses stuff like '%3A' for the ':' for example. The
> conversion is here:
> 
> http://www.ascii.cl/htmlcodes.htm
> 
> Is there a python package/module/whatever that does the conversion for
> me or do I have to write a little wrapper myself (and introduce bugs
> while doing so :))?
> 
> Cheers,
> Daniel

>>> import urllib
>>> urllib.unquote('%20')
' '

<http://docs.python.org/library/urllib.html#utility-functions>
-- 



More information about the Python-list mailing list