[REBOL] Re: URL encoding ?
From: gscottjones::mchsi::com at: 24-Oct-2002 6:56
From: "Holzammer, Jean"
> I'd like to encode a URL.
>
> URL: http://www.bla.org/cgi-bin/bla.cgi?a=1&b=xyz
...
> I need:
> http%3A%2F%2Fwww.bla.org%2Fcgi-bin%2Fbla.cgi%3Fa%3D1%26b%3Dxyz
Hi, Jean,
No built in function will do this, at least to my knowledge. The following
appears to work:
url: "http://www.bla.org/cgi-bin/bla.cgi?a=1&b=xyz"
replace/all url ":" "%3A"
replace/all url "/" "%2F"
replace/all url "?" "%3F"
replace/all url "=" "%3D"
replace/all url "&" "%26"
url: to-url url
;== http%3A%2F%2Fwww.bla.org%2Fcgi-bin%2Fbla.cgi%3Fa%3D1%26b%3Dxyz
The final to-url should catch all those other special characters, if any.
HTH.
--Scott Jones