Handle non-latin uris

Ruby's URI.parse does not accept non-latin characters, and will raise an error on any uri that is not completely in the latin alphabet. This is a problem for example, in japanese uris.

I'm no expert on this, but when I googled around (eg. [here](https://www.ruby-forum.com/topic/4409560)) the correct way to handle it seems to be to escape the string before parsing.

I've added tests and updated the format attribute to escape uris before parsing them.