To:                     [EMAIL PROTECTED]
From:                   [EMAIL PROTECTED]
Send reply to:          [EMAIL PROTECTED]
Date sent:              Tue, 25 Apr 2000 15:02:15 -0200
Subject:                [REBOL] Passing URLs to Rebol?

> 
> Hello, Being a new user to REBOL I am having trouble acting on the
> following URL.  What do I have to do to get this to work? Any help on this
> would be appreciated.  The error message from REBOL is below.  
> 
> URL: http://ca.finance.yahoo.com/d/quotes.csv?s=@^AV.TO&f=sl1d1t1c1ohgv&e=.csv
> 
> The following is the error message I get back.  
> 
> Script: "Active Stocks" ("Tuesday, April 25, 2000")
> ** User Error: URL error: http://ca.finance.yahoo.com/d/quotes.csv?s=@^AV.TO&f
> =sl1d1t1c1ohgv&e=.csv.
> ** Where: Toronto: read http://ca.finance.yahoo.com/d/quotes.csv?s=@^AV.TO&f=s
> l1d1t1c1ohgv&e=.csv write/binary %toronto.csv

Hi Doug,

The ^ in the URL is causing your main problem.  ^ is REBOLs escape 
character, and ^A is being converted to CTRL-A (ASCII 1).

If you correctly URL-encode the ^ character (%5E), you'll end up with 
something like:

a: read http://ca.finance.yahoo.com/d/quotes.csv?s=@%5EAV.TO&f=sl1d1t1c1ohgv&e=.csv

Unfortunately, THIS WON'T WORK!  Here's the second problem.

REBOL un-escapes the %5E to ^, then doesn't re-escape it when sending 
it out to the web server.  (Ralph and I discussed this on the list 
briefly last week.  Nobody has confirmed whether this has been 
reported or not, so I am writing a bug report to [EMAIL PROTECTED] 
as soon as this message is sent.)

Your working solution is to set your URL up as a string, escaping the 
^ as %5E, then run it through to-url as you're reading it, like this:

>> a: "http://ca.finance.yahoo.com/d/quotes.csv?s=@%5EAV.TO&f=sl1d1t1c1ohgv&e=.csv"
== {http://ca.finance.yahoo.com/d/quotes.csv?s=@%5EAV.TO&f=sl1d1t1c1ohgv&e=.csv}
>>b: read to-url a
== {"ULP.TO",12.90,"4/25/2000","1:24PM",+0.05,12.85,12.95,12.85,2599688
"NT.TO",150.50,"4/25/2000","1:25PM",+7.00,148.50,151.25,147...

Cheers,
Kev

------------------------------------------------------------------------
Kevin McKinnon, Network Engineer                 [EMAIL PROTECTED]
Sunshine Communications                     http://www.sunshinecable.com

PGP Public Key: http://www.dockmaster.net/pgp.html   PGP 6.0 www.pgp.com

Reply via email to