title: Ruby URI::InvalidURIError: bad URI(is not URI?) besides encoding
body: <p>I know this is a common error and i'm using a known solution but its still giving me the same error:</p>
  
  <pre><code>require 'open-uri'
  url = "http://website.com/dirs/filex[a]"
  
  safeurl = URI.parse(URI.encode(url))
  ...
  </code></pre>
  
  <p>Gives <code>URI::InvalidURIError: bad URI(is not URI?):</code></p>
  
  <p>I know its the <code>[</code> and <code>]</code> characters causing this. But the URI.encode isn't doing anything</p>
  
  <p>What am I doing wrong?</p>