title: Trouble opening utf-8 URI's with Ruby's 'open-uri'
body: <p>I'm trying to get Danish location addresses from google maps web services API with ruby and open-uri.</p>
  
  <p>Trying to get <strong>Ærø, Denmark</strong>: <em>http://maps.googleapis.com/maps/api/geocode/json?address=ærø&amp;sensor=false&amp;region=dk</em> works in Chrome does not with open-uri:</p>
  
  <pre><code>require 'rubygems'
  require "open-uri"
  require 'json'
  
  uri = "http://maps.googleapis.com/maps/api/geocode/json?address=ærø&amp;sensor=false&amp;region=dk"
  response = open(uri)
  array = JSON.parse(response)
  pp array
  </code></pre>
  
  <p>Here it yields </p>
  
  <pre><code>/usr/lib/ruby/1.8/uri/common.rb:436:in `split': bad URI(is not URI?): http://maps.googleapis.com/maps/api/geocode/json?address=ærø&amp;sensor=false&amp;region=dk (URI::InvalidURIError)
  </code></pre>
  
  <p>Another way of doing it seems to be to escape characters:</p>
  
  <pre><code>uri = "http://maps.googleapis.com/maps/api/geocode/json?address=ærø&amp;sensor=false&amp;region=dk"
  uri_escaped = URI.escape(uri)
  response = open(uri_escaped)
  array = JSON.parse(response.read)
  pp array
  </code></pre>
  
  <p>But this yields an escaped result (which is not sought after :-)</p>
  
  <p>Anyone have any idea what could solve this problem (getting unescaped feedback or sending an utf-8 request)?</p>
  
  <p>Ruby version here is 1.8.7</p>