title: Ruby: How to escape url with square brackets [ and ]?
body: <p>This url: </p>
  
  <pre><code>http://gawker.com/5953728/if-alison-brie-and-gillian-jacobs-pin-up-special-doesnt-get-community-back-on-the-air-nothing-will-[nsfw]
  </code></pre>
  
  <p>should be:</p>
  
  <pre><code>http://gawker.com/5953728/if-alison-brie-and-gillian-jacobs-pin-up-special-doesnt-get-community-back-on-the-air-nothing-will-%5Bnsfw%5D
  </code></pre>
  
  <p>But when I pass the first one into <code>URI.encode</code>, it doesn't escape the square brackets. I also tried <code>CGI.escape</code>, but that escapes all the '/' as well.</p>
  
  <p>What should I use to escape URLS properly? Why doesn't <code>URI.encode</code> escape square brackets?</p>