title: Problems with parse while encoding ascii string
body: <p>I'm trying to encode a string <code>VULGO PIVETÃO</code>, but i'm getting an error <code>URI must be ascii only &quot;https://127.0.0.1:2999/liveclientdata/playerscores?summonerName=VULGO PIVET\\u00C3O&quot; (URI::InvalidURIError)</code>. I have tried the following block:</p>
  <pre><code>
  URI = &quot;https://127.0.0.1:2999&quot;
  
  ENDPOINTS = { 
      allgamedata: &quot;liveclientdata/allgamedata&quot;,
      activeplayer: &quot;liveclientdata/activeplayer&quot;,
      playerlist: &quot;liveclientdata/playerlist&quot;,
      eventdata: &quot;liveclientdata/eventdata&quot;,
      playerscore: &quot;liveclientdata/playerscores&quot;
  } 
  
  def get_playerscore summoner_name
      summoner_name = &quot;VULGO PIVETÃO&quot;
  
      begin
          encoded_string = URI.parse(summoner_name)
      rescue URI::InvalidURIError
          encoded_string = URI.parse(URI.escape(summoner_name))
      end
  
      JSON.parse(Utils.req(&quot;GET&quot;,&quot;#{URI}/#{ENDPOINTS[:playerscore]}?summonerName=#{encoded_string}&quot;, {}, false))
  end
  
  
  </code></pre>
  <p>But i'm still getting another error: <code>rescue in get_playerscore': &quot;https://127.0.0.1:2999&quot; is not a class/module (TypeError)</code></p>
  <blockquote>
  <p>SOLVED</p>
  </blockquote>
  <p>According to <code>@mu is too short</code> suggestion, using the library: <em>Addressable</em>, I solved the problem with this block of code:</p>
  <pre><code>uri = &quot;#{URI}/#{ENDPOINTS[:playerscore]}?summonerName=#{summoner_name}&quot;
  uri = Addressable::URI.parse(uri)
  uri = uri.normalize
  
  JSON.parse(Utils.req(&quot;GET&quot;, uri, {}, false))
  </code></pre>