[REBOL] NETSCAPE vs EXPLORER... CGI problem solved! Re:(2)

2000-07-08 Thread ralph


>
> You can also use to-url to do that for you
>
> >> d: to-url "this has spaces"
> == this%20has%20spaces
>
> d: to-url "this has spaces and (parens)"
> == this%20has%20spaces%20and%20%28parens%29
>

You got me on the right track, Allen (thanks!) but it was a bit trickier
than just using to-url If I tried to print the translated URL (as I do
in looping through and constructing secure URLs for books that can be
ordered) I lost the escapes. Finally it occurred to me (slowly but surely)
to just PROBE the little mudpuppies! That works and keeps the format.

For any of those interested, you can see all this in action at
http://abooks.com. Click on any book title; either the random ones or
through either of the searches available.

And, as a bonus, here's the code of how I do it... enjoy:

 escape for Netscape ;;;


print {https://abooks.safeserver.com/cgi-bin/bookord.r?title=" 
title
order: join order {&author=}
order: join order trim author
order: join order {&isbn=}
order: join order trim isbn
order: join order {&pub=}
order: join order trim pub
order: join order {&price=}
order: join order trim price
order: make url! order
probe order
print {">}
print trim title
print ""


--Ralph Roberts





[REBOL] NETSCAPE vs EXPLORER... CGI problem solved! Re:(2)

2000-07-08 Thread ralph

darn... can't believe to-url slipped me mind... thanks!

--Ralph

> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Saturday, July 08, 2000 8:58 PM
> To: [EMAIL PROTECTED]
> Subject: [REBOL] NETSCAPE vs EXPLORER... CGI problem solved! Re:
>
>
> > There are other ways to solve this (in my humble opinion)
> deficiency in at
> > least early Netscape (4.03 is the latest I have or want, I
> just use it
> to
> > make sure stuff works in both flavor browsers). One way is the following
> > little REBOL function:
> >
> > cgi-escape: func [cgi][
> > parse cgi [some [to " " (find replace cgi " " "%20")] to end]
> > ]
>
> Hi Ralph,
>
> You can also use to-url to do that for you
>
> >> d: to-url "this has spaces"
> == this%20has%20spaces
>
> d: to-url "this has spaces and (parens)"
> == this%20has%20spaces%20and%20%28parens%29
>
> It is also fairly common to escape the " " with "+" instead, because it is
> shorter by 2 chars.
>
> Check out,
>
> http://www.rebol.org/web/url-encode.r
>
> this does the encoding as well as the " " to "+"
>
>
> Cheers,
>
> Allen K
>