How to unencode a string

jakecjacobson jakecjacobson at gmail.com
Fri Aug 28 15:57:59 CEST 2009


On Aug 27, 6:51 pm, Piet van Oostrum <p... at cs.uu.nl> wrote:
> >>>>> jakecjacobson <jakecjacob... at gmail.com> (j) wrote:
> >j> This seems like a real simple newbie question but how can a person
> >j> unencode a string?  In Perl I use something like: "$part=~ s/\%([A-Fa-
> >j> f0-9]{2})/pack('C', hex($1))/seg;"
> >j> If I have a string like Word1%20Word2%20Word3 I want to get Word1
> >j> Word2 Word3.  
>
> urllib.unquote(string)
>
> >j> Would also like to handle special characters like '",(){}
> >j> [] etc/
>
> What would you like to do with them? Or do you mean to replace %27 by ' etc?
> --
> Piet van Oostrum <p... at cs.uu.nl>
> URL:http://pietvanoostrum.com[PGP 8DAE142BE17999C4]
> Private email: p... at vanoostrum.org

Yes, take '%27' and replace with ', etc.



More information about the Python-list mailing list