]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/geocoder_controller.rb
smarter whichways behaviour, couple of small bugfixes
[rails.git] / app / controllers / geocoder_controller.rb
index 76b157faabd6058f2c536711dc49942115939416..4ce31baf4da099dd1d1e61cbbb502efa5ec37e51 100644 (file)
@@ -1,6 +1,7 @@
 class GeocoderController < ApplicationController
   layout 'site'
 
+  require 'uri'
   require 'net/http'
   require 'rexml/document'
 
@@ -110,7 +111,7 @@ class GeocoderController < ApplicationController
     @res_ary = []
     begin
       Net::HTTP.start('ws.geonames.org') do |http|
-        res = http.get("/search?q=#{@place_name}&maxRows=10")
+        res = http.get("/search?q=#{URI.escape(@place_name)}&maxRows=10")
         xml = REXML::Document.new(res.body)
         xml.elements.each("geonames/geoname") do |ele|
           res_hash = {}