Decode URL encoding...?

Started by cormullion, June 02, 2008, 08:52:45 AM

Previous topic - Next topic

cormullion

Is there an easy way in newLISP to decode this sort of encoding?


pish+and+tush%0D%0A%0D%0Aflannel+and+soap%0D%0A%0D%0A%3CI+don%27t+think+this+blog+is+very+good

I can handle replacing the + signs, but all those % codes need converting too...

Lutz

#1
From modules/cgi.lsp:



(define (url-translate str)
   (replace "+" str " ")
   (replace "%([0-9A-F][0-9A-F])" str (char (int (append "0x" $1))) 1))


See also here: http://newlisp.org/code/modules/cgi.lsp.html">http://newlisp.org/code/modules/cgi.lsp.html

cormullion

#2
Ah good! I haven't looked inside cgi.lsp much, even though I use it lots...



Thanks!