[topic] URL特殊文字のエスケープ

URL用に特殊な文字をエスケープする。

Posted feedbacks - OCaml

Ocamlnetのほうは空白をどちらに変換するか選択できます。

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
(*Ocamlnetのnetstring
  ocaml -I +pcre -I +netsys -I +netstring  \
    unix.cma pcre.cma netsys.cma netstring.cma*)
    
  open Netencoding;;
(* ' ' <-> '+' *)
  Url.encode "~url quote";;
  Url.decode "%7Eurl+quote";;
(* ' ' <-> '%20' *)
  Url.encode ~plus:false "~url quote" ;;
  Url.decode ~plus:false "%7Eurl%20quote";;


(*libcurl-ocaml(ocurl?)
  ocaml -I +curl curl.cma*)
  Curl.escape "~url quote";; 
  Curl.unescape "%7Eurl%20quote";;

Index

Feed

Other

Link

Pathtraq

loading...