url-encode-char
Name
url-encode-char -- Returns the url-encoded equivalent of a character
Synopsis
(url-encode-char ch)
Description
Converts ch to a properly encoded URL character.
Author
Norman Walsh, <ndw@nwalsh.com>
Source Code
(define (url-encode-char ch)
;; Returns the url-encoded equivalent of a character
(cond ((char=? ch #\space) "%20") ; space
((char=? ch #\U-0026) "%26") ; ampersand
((char=? ch #\?) "%3F") ; question
((char=? ch #\{) "%7B") ; open curly
((char=? ch #\}) "%7D") ; close curly
((char=? ch #\|) "%7C") ; vertical bar
((char=? ch #\\) "%5C") ; backslash
((char=? ch #\/) "%2F") ; slash
((char=? ch #\^) "%5E") ; caret
((char=? ch #\~) "%7E") ; tilde
((char=? ch #\[) "%5B") ; open square
((char=? ch #\]) "%5D") ; close square
((char=? ch #\`) "%60") ; backtick
((char=? ch #\%) "%25") ; percent
((char=? ch #\+) "%2B") ; plus
(else (string ch))))