Issue #10507 has been updated by Juanito Fatas.


Encode + URI + open.

```
ruby -v -ruri -e "open(URI(URI.encode 'http://localhost:3000/?url=google.com&clipRect={"top":0,"left":0,"width":1050,"height":700}'))"
ruby 2.0.0p598 (2014-11-13) [x86_64-darwin13.3.0]
-e:1:in `<main>': warning: URI.escape is obsolete
-e:1:in `open': no implicit conversion of URI::HTTP into String (TypeError)
	from -e:1:in `<main>'

ruby -v -ruri -e "open(URI(URI.encode 'http://localhost:3000/?url=google.com&clipRect={"top":0,"left":0,"width":1050,"height":700}'))"
ruby 2.1.5p273 (2014-11-13 revision 48405) [x86_64-darwin13.0]
-e:1:in `<main>': warning: URI.escape is obsolete
-e:1:in `open': no implicit conversion of URI::HTTP into String (TypeError)
	from -e:1:in `<main>'

ruby -v -ruri -e "open(URI(URI.encode 'http://localhost:3000/?url=google.com&clipRect={"top":0,"left":0,"width":1050,"height":700}'))"
ruby 2.2.0preview1 (2014-09-17 trunk 47616) [x86_64-darwin13]
-e:1:in `<main>': warning: URI.escape is obsolete
-e:1:in `open': no implicit conversion of URI::HTTP into String (TypeError)
	from -e:1:in `<main>'
```


----------------------------------------
Bug #10507: URI Error: bad URI(is not URI?) in Ruby 2.0.0, 2.1.5, 2.2.0preview1
https://bugs.ruby-lang.org/issues/10507#change-49944

* Author: Juanito Fatas
* Status: Open
* Priority: Normal
* Assignee: 
* Category: 
* Target version: 
* ruby -v:  2.1.5p273
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN
----------------------------------------
This url is used to get a screenshot from a [web service](https://github.com/fzaninotto/screenshot-as-a-service) and specify the dimensions.


### Ruby 2.0.0p598

```
ruby -v -ruri -e "URI 'http://localhost:3000/?url=google.com&clipRect={"top":0,"left":0,"width":1050,"height":700}'"
ruby 2.0.0p598 (2014-11-13) [x86_64-darwin13.3.0]
/Users/Juan/.rubies/ruby-2.0.0-p598/lib/ruby/2.0.0/uri/common.rb:176:in `split': bad URI(is not URI?): http://localhost:3000/?url=google.com&clipRect={top:0,left:0,width:1050,height:700} (URI::InvalidURIError)
	from /Users/Juan/.rubies/ruby-2.0.0-p598/lib/ruby/2.0.0/uri/common.rb:211:in `parse'
	from /Users/Juan/.rubies/ruby-2.0.0-p598/lib/ruby/2.0.0/uri/common.rb:747:in `parse'
	from /Users/Juan/.rubies/ruby-2.0.0-p598/lib/ruby/2.0.0/uri/common.rb:996:in `URI'
	from -e:1:in `<main>'
```

### Ruby 2.1.5p273

```
$ ruby -v -ruri -e "URI 'http://localhost:3000/?url=google.com&clipRect={"top":0,"left":0,"width":1050,"height":700}'"
ruby 2.1.5p273 (2014-11-13 revision 48405) [x86_64-darwin13.0]
/Users/Juan/.rubies/ruby-2.1.5/lib/ruby/2.1.0/uri/common.rb:176:in `split': bad URI(is not URI?): http://localhost:3000/?url=google.com&clipRect={top:0,left:0,width:1050,height:700} (URI::InvalidURIError)
	from /Users/Juan/.rubies/ruby-2.1.5/lib/ruby/2.1.0/uri/common.rb:211:in `parse'
	from /Users/Juan/.rubies/ruby-2.1.5/lib/ruby/2.1.0/uri/common.rb:747:in `parse'
	from /Users/Juan/.rubies/ruby-2.1.5/lib/ruby/2.1.0/uri/common.rb:1232:in `URI'
	from -e:1:in `<main>'
```

### Ruby 2.2.0preview1

```
$ ruby -v -ruri -e "URI 'http://localhost:3000/?url=google.com&clipRect={"top":0,"left":0,"width":1050,"height":700}'"
ruby 2.2.0preview1 (2014-09-17 trunk 47616) [x86_64-darwin13]
/Users/Juan/.rubies/ruby-2.2.0-preview1/lib/ruby/2.2.0/uri/rfc3986_parser.rb:47:in `split': bad URI(is not URI?): http://localhost:3000/?url=google.com&clipRect={top:0,left:0,width:1050,height:700} (URI::InvalidURIError)
	from /Users/Juan/.rubies/ruby-2.2.0-preview1/lib/ruby/2.2.0/uri/rfc3986_parser.rb:53:in `parse'
	from /Users/Juan/.rubies/ruby-2.2.0-preview1/lib/ruby/2.2.0/uri/common.rb:226:in `parse'
	from /Users/Juan/.rubies/ruby-2.2.0-preview1/lib/ruby/2.2.0/uri/common.rb:713:in `URI'
	from -e:1:in `<main>'
```

Thank you!



-- 
https://bugs.ruby-lang.org/