The NEWLISP standard library does not provide URL-encoded support, so find the following code from the Dragonfly library, which can be used for testing.
;===============================================================================; ! UTF8 Compatible URL encoding/decoding;=========================================================================== = = = (constant ' regex_http_special_str (Regex-comp {[^.0-9a-z]+)} 1)) (Constant ' Regex_hex_encoded_char (Regex-comp { % ([0-9a-f][0-9a-f])} 1) (Define (Hex-encode-str str, CNVRT) (setf cnvrt (dup "%%%x" (length str))) (Eval (append ' (Format cn VRT) (Unpack (DUP "B" (length str))))); @syntax (Utf8-urlencode <str> [<bool-everything>]);; @param str the string to encode;; @param bool-everything whether to escape the entire string or just most of the "Non-ascii friendly" parts.; <p>use this function to safely encode data that might has foreign characters in it, or simply;; Characters that should is placed into urls:</p>;; <b>example:</b>;; <pre> (Utf8-urlencode "What's It?") = "what%20time%20is%20it%3f" </pre> (define (utf8-urlencode str everything) (If everything (hex-encode-str str) (replace Regex_http_special_str str (HEX-ENCODE-STR $) 0x10000)); @syntax (Utf8-urldecode <str>);; <p>decodes a utf8-urlencoded string. Converts ' + ' s to spaces.</p> (define (Utf8-urldecode str) (replace "+" str ") (Replace Regex_hex_encoded_char str (p Ack "B" (int nil)) 0x10000))
newLISP URL Encoding