Forum: Ruby on Rails open_uri failure on good uri.

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
6d465bb8df6bda89904c7aafea0dda6c?d=identicon&s=25 Don French (Guest)
on 2009-01-28 02:36
(Received via mailing list)
I am trying to open a URI using doc = Nokogiri::HTML(open(url)). I get
the following error:

URI::InvalidURIError: bad URI(is not URI?):
http://www.mauipropertytax.com/Datalets.asp?mnu=PS...
        from /usr/local/ruby/lib/ruby/1.8/uri/common.rb:436:in `split'
        from /usr/local/ruby/lib/ruby/1.8/uri/common.rb:485:in `parse'
        from /usr/local/ruby/lib/ruby/1.8/open-uri.rb:29:in `open'

The problem is, if I paste the url in a browser it does go to the
proper page.  What am I missing
Ef3aa7f7e577ea8cd620462724ddf73b?d=identicon&s=25 Rob Biedenharn (Guest)
on 2009-01-28 03:23
(Received via mailing list)
On Jan 27, 2009, at 8:35 PM, Don French wrote:
> The problem is, if I paste the url in a browser it does go to the
> proper page.  What am I missing

Try replacing the | characters with %7C

Or try:

doc = Nokogiri::HTML(open(URI.encode(url)))

-Rob

Rob Biedenharn    http://agileconsultingllc.com
Rob@AgileConsultingLLC.com
6d465bb8df6bda89904c7aafea0dda6c?d=identicon&s=25 Don French (Guest)
on 2009-01-28 05:05
(Received via mailing list)
That worked perfectly. Thanks

Don

On Jan 27, 4:22 pm, Rob Biedenharn <R...@AgileConsultingLLC.com>
This topic is locked and can not be replied to.