open_uri failure on good uri.

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=PSearch&submnu=Profile&pin=390350950000&tp=2&cp=1&State=1|1|\*&item=1         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

Try replacing the | characters with %7C

Or try:

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

-Rob

Rob Biedenharn http://agileconsultingllc.com Rob@AgileConsultingLLC.com

That worked perfectly. Thanks

Don