Issue #9563 has been updated by Sam Rawlins.


You must first encode the String properly with URI.escape:

>> require 'uri'
=> true
>> URI.escape("http://upload.wikimedia.org/wikipedia/commons/1/1c/01-Russian_alphabet-_.svg")
=> "http://upload.wikimedia.org/wikipedia/commons/1/1c/01-Russian_alphabet-%D0%90_%D0%B0.svg"
>> URI.parse(URI.escape("http://upload.wikimedia.org/wikipedia/commons/1/1c/01-Russian_alphabet-_.svg"))
=> #<URI::HTTP:0x007fbe4304e468 URL:http://upload.wikimedia.org/wikipedia/commons/1/1c/01-Russian_alphabet-%D0%90_%D0%B0.svg>
>> URI.parse(URI.escape("http://upload.wikimedia.org/wikipedia/commons/1/1c/01-Russian_alphabet-_.svg")).to_s
=> "http://upload.wikimedia.org/wikipedia/commons/1/1c/01-Russian_alphabet-%D0%90_%D0%B0.svg"

This could be better documented.

----------------------------------------
Bug #9563: URI.parse error
https://bugs.ruby-lang.org/issues/9563#change-45555

* Author: Evgeniy Serykh
* Status: Open
* Priority: Normal
* Assignee: 
* Category: 
* Target version: 
* ruby -v: ruby 2.1.0p0 (2013-12-25 revision 44422)
* Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN, 2.1: UNKNOWN
----------------------------------------
I have the error for the url :

`... 
pry(main)> URI.parse "http://upload.wikimedia.org/wikipedia/commons/1/1c/01-Russian_alphabet-_.svg"
URI::InvalidURIError: bad URI(is not URI?): http://upload.wikimedia.org/wikipedia/commons/1/1c/01-Russian_alphabet-_.svg` 

My ruby version is: 

`$ ruby -v
ruby 2.1.0p0 (2013-12-25 revision 44422) [x86_64-darwin13.0]`



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