当前位置 : 主页 > 网页制作 > HTTP/TCP >

URL解码Common Lisp中的字符串

来源:互联网 收集:自由互联 发布时间:2021-06-16
我有一个包含转义网址的字符串: http%3A%2F%2Fexample.com%3Ffoo%3Dbar+baz 我正在尝试将其解码为以下内容: http://example.com?foo=bar+baz 但是,我找不到Drakma导出的任何合适的功能.我可以像这样编码
我有一个包含转义网址的字符串:

http%3A%2F%2Fexample.com%3Ffoo%3Dbar+baz

我正在尝试将其解码为以下内容:

http://example.com?foo=bar+baz

但是,我找不到Drakma导出的任何合适的功能.我可以像这样编码:

* url-string

"http://example.com?foo=bar+baz"
* (drakma:url-encode url-string :utf-8)

"http%3A%2F%2Fexample.com%3Ffoo%3Dbar%2Bbaz"

……所以我认为我走在正确的轨道上.如果有人能提供正确方向的推动我会很感激:-)我正在使用SBCL 1.0.54,它是从64位Linux Mint 13上的源代码构建的.

如果它有助于澄清我正在尝试做什么,在Ruby中,我会做以下事情:

> uri_string = "http%3A%2F%2Fexample.com%3Ffoo%3Dbar+baz"
 => "http%3A%2F%2Fexample.com%3Ffoo%3Dbar+baz" 
> URI.decode uri_string
 => "http://example.com?foo=bar+baz"
快速SLIME会话.

CL-USER> (ql-dist:system-apropos "url")

#<SYSTEM curly / curly-20120407-git / quicklisp 2012-05-20>
#<SYSTEM curly.test / curly-20120407-git / quicklisp 2012-05-20>
#<SYSTEM do-urlencode / do-urlencode-20120407-git / quicklisp 2012-05-20>
#<SYSTEM url-rewrite / url-rewrite-0.1.1 / quicklisp 2012-05-20>

CL-USER> (ql:quickload :do-urlencode)

C-CC-dpdo-urlencodeRET

DO-URLENCODE:URLDECODE
  Function: (not documented)
DO-URLENCODE:URLENCODE
  Function: (not documented)
DO-URLENCODE:URLENCODE-MALFORMED-STRING
  Type: (not documented)
DO-URLENCODE:URLENCODE-MALFORMED-STRING-STRING
  Generic Function: (not documented)

CL-USER> (do-urlencode:urldecode "http%3A%2F%2Fexample.com%3Ffoo%3Dbar%2Bbaz")

"http://example.com?foo=bar+baz"
网友评论