url problem
[1/10] from: louisaturk:eudoramail at: 28-Dec-2001 23:27
Fellow rebols,
How can I get rebol to read a url containing the ! character?
Louis
>> x: http://www.wayoflife.org/fbns/churchdir/!unitedstates.htm
== http://www.wayoflife.org/fbns/churchdir/!unitedstates.htm
>> y: read x
** User Error: URL error:
http://www.wayoflife.org/fbns/churchdir/!unitedstates.htm
** Near: y: read x
[2/10] from: joel:neely:fedex at: 28-Dec-2001 23:33
Hi, Louis,
Use URL encoding in a string ...
Dr. Louis A. Turk
wrote:
> How can I get rebol to read a url containing the ! character?
> Louis
<<quoted lines omitted: 5>>
> ** Near: y: read x
> >>
... 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" ;
[3/10] from: louisaturk:eudoramail at: 29-Dec-2001 0:32
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}
>>
Louis
At 11:33 PM 12/28/2001 -0600, you wrote:
[4/10] from: slok00::yahoo at: 29-Dec-2001 16:48
what if you replace "!" with "%21" without the quotes.
I got a network timeout from here. Not sure if it will work on your side
x: read to-url "http://www.wayoflife.org/fbns/churchdir/%21unitedstates.htm"
YekSoon
At 12:32 AM 12/29/2001 -0600, you wrote:
[5/10] 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?
<<quoted lines omitted: 7>>
> >Use URL encoding in a string ...
> >
...
> >
> >... as follows:
<<quoted lines omitted: 16>>
> >-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" ;
[6/10] from: louisaturk:eudoramail at: 29-Dec-2001 7:01
Joel,
You stuck the answer right in front of my eyes, but I didn't see
it! :>) Well I should go to bed; that is the problem. But I want to get
this done!!!!!
Thanks,
Louis
At 06:17 AM 12/29/2001 -0600, you wrote:
[7/10] from: joel:neely:fedex at: 29-Dec-2001 7:13
Hi, Louis,
Dr. Louis A. Turk
wrote:
> Joel,
>
> You stuck the answer right in front of my eyes, but I didn't
> see it! :>)
>
If I had a nickel for every bug in plain sight that I couldn't
see I'd be independently wealthy (and investing in RT... ;-)
I've actually fixed programs by describing them to my wife
(who is no dummy, but she's a second-grade teacher with little
time for geekish esoterica...)
> Well I should go to bed; that is the problem.
> But I want to get this done!!!!!
>
When a hack attack strikes, all you can do is ride it out!
-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" ;
[8/10] from: louisaturk:eudoramail at: 29-Dec-2001 5:55
YekSoon,
Many thanks. I thought that % and some number might be needed, but I
didn't know the number for !
However, it also needs cury braces. This works:
x: read to-url {http://www.wayoflife.org/fbns/churchdir/%21unitedstates.htm}
Seems to me that rebol should take care of this without all the work-a-round.
Thanks again to you and to Joel also.
Louis
At 04:48 PM 12/29/2001 +0800, you wrote:
[9/10] from: tomc::darkwing::uoregon::edu at: 29-Dec-2001 12:12
Hi Louis,
Many moons ago I wrote %url-encode.r with a /re(encode) refinement that
will help your current situation.
>> do http://www.rebol.org/web/url-encode.r
>>
>> x: read to-url url-encode/re "http://www.wayoflife.org/fbns/churchdir/!unitedstates.htm"
== {<html>
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<meta name="GENERATOR" content="Mi...
>>
On Sat, 29 Dec 2001, Dr. Louis A. Turk wrote:
[10/10] from: louisaturk:eudoramail at: 30-Dec-2001 20:34
Tom,
I just tried your url-encode function. Very nice and useful for my present
needs. Many thanks!
Louis
At 12:12 PM 12/29/2001 -0800, you wrote:
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted