Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > open-uri and illegal url characters

Reply
Thread Tools

open-uri and illegal url characters

 
 
bsagert@gmail.com
Guest
Posts: n/a
 
      06-06-2008
Hello, n00b here. I use open-uri to read a Yahoo .csv file of stock
and index quotes. Yahoo indices start with a circumflex ("^") which a
browser will convert to "%5e". The following line is rejected by Yahoo
(andRuby) ==>s=open('http://download.finance.yahoo.com
/d/quotes.csv?s=^DJI,^SPX,^IXIC&f=sl1d1t1nohgv&e=.csv ').read
Is there a Ruby method that will automatically convert illegal
characters into url-speak? Thanks, Bill
 
Reply With Quote
 
 
 
 
bsagert@gmail.com
Guest
Posts: n/a
 
      06-06-2008
On Jun 6, 12:56 pm, (E-Mail Removed) wrote:
> Hello, n00b here. I use open-uri to read a Yahoo .csv file of stock
> and index quotes. Yahoo indices start with a circumflex ("^") which a
> browser will convert to "%5e". The following line is rejected by Yahoo
> (andRuby) ==>s=open('http://download.finance.yahoo.com/d/quotes.csv?s=^DJI,^SPX,^IXIC&f=sl1d1t1nohgv&e=.csv ').read
> Is there a Ruby method that will automatically convert illegal
> characters into url-speak? Thanks, Bill


Oops, that url is ==> http://download.finance.yahoo.com/d/...t1nohgv&e=.csv
 
Reply With Quote
 
 
 
 
Donald Ball
Guest
Posts: n/a
 
      06-06-2008
require 'cgi'

CGI.escape('^') => "%5E"

 
Reply With Quote
 
bsagert@gmail.com
Guest
Posts: n/a
 
      06-06-2008
On Jun 6, 1:00 pm, (E-Mail Removed) wrote:
> On Jun 6, 12:56 pm, (E-Mail Removed) wrote:
>
> > Hello, n00b here. I use open-uri to read a Yahoo .csv file of stock
> > and index quotes. Yahoo indices start with a circumflex ("^") which a
> > browser will convert to "%5e". The following line is rejected by Yahoo
> > (andRuby) ==>s=open('http://download.finance.yahoo.com/d/quotes.csv?s=^DJI,^SPX,^IXIC&f=sl1d1t1nohgv&e=.csv ').read
> > Is there a Ruby method that will automatically convert illegal
> > characters into url-speak? Thanks, Bill

>
> Oops, that url is ==>http://download.finance.yahoo.com/d/...,%5eSPX,%5eIXI...


Jeez, I really am a newbie. Of course the above link will work fine in
a browser.
The point is, it won't work in a Ruby script! The open-uri module
won't convert "^"
to "%5e" and the question is, is there a Ruby way?
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
illegal characters Paul Young XML 1 01-30-2005 04:02 PM
Illegal characters in variables passed via a fat url? Fernie HTML 10 12-21-2004 11:53 PM
Replacing "illegal characters" in html BenO Python 0 05-09-2004 07:48 PM
Digester and illegal characters Markos Charatzas Java 2 03-05-2004 10:38 AM
Solution for "illegal characters in path" error message in ASP.NET Steve Grahovac ASP .Net 1 01-02-2004 10:04 PM



Advertisments