[topic] URL特殊文字のエスケープ
Posted feedbacks - Scheme
Gaucheではrfc.uriモジュールを使います。
1 2 3 4 | gosh> (use rfc.uri)
#<undef>
gosh> (uri-encode-string "~url quote/ほげ")
"~url%20quote%2f%c2%a4%db%a4%c2%b2"
|
ちなみに、URI中でエスケープしなくて良い文字はRFC2396とRFC3986で若干異なっています。rfc.uriモジュールはRFC3986に従っていますが、キーワード引数を与えることで変えることが可能です。
1 2 3 4 | gosh> (uri-encode-string "!(foo*)")
"%21%28foo%2a%29"
gosh> (uri-encode-string "!(foo*)" :noescape *rfc2396-unreserved-char-set*)
"!(foo*)"
|





にしお
#4156()
Rating0/0=0.00
URL用に特殊な文字をエスケープする。
[ reply ]