You can use `URI.escape(uri)`. You can parse the result perfectly fine.