[REBOL] Re: url problem
From: joel:neely:fedex at: 29-Dec-2001 6:17
Hi, Louis,
You're not replacing the bang ("!") with "%21" in the string.
URL encoding replaces almost all special characters with their
ASCII equivalent in hexadecimal, preceded by a percent sign.
(All special characters except those having specific meaning
in a URL, such as "/", and those explicitly allowed in host
names and paths, such as "-".)
Take another look at my example...
-jn-
Dr. Louis A. Turk
wrote:
> Joel,
>
> What am I still doing wrong?
>
> >> x: read to-url "http://www.wayoflife.org/fbns/churchdir/!unitedstates.htm"
> ** User Error: URL error:
> http://www.wayoflife.org/fbns/churchdir/!unitedstates.htm
> ** Near: x: read to-url
> {http://www.wayoflife.org/fbns/churchdir/!unitedstates.htm}
> >>
>
> >
> >Use URL encoding in a string ...
> >
...
> >
> >... as follows:
> >
> > >> y: read to-url
> >"http://www.wayoflife.org/fbns/churchdir/%21unitedstates.htm"
> > == {<html>
> >
> >
> >
> > <head>
> >
> > <meta http-equiv="Content-Type"
> >
> > content="text/html; charset=iso-8859-1">
> >
> > <meta name="GENERATOR" content="Mi...
> > >>
> >
> >-jn-
> >
--
; sub REBOL {}; sub head ($) {@_[0]}
REBOL []
# despam: func [e] [replace replace/all e ":" "." "#" "@"]
; sub despam {my ($e) = @_; $e =~ tr/:#/.@/; return "\n$e"}
print head reverse despam "moc:xedef#yleen:leoj" ;