diff options
author | Matthew Somerville <matthew@fury.ukcod.org.uk> | 2011-02-16 19:23:48 +0000 |
---|---|---|
committer | Matthew Somerville <matthew@fury.ukcod.org.uk> | 2011-02-16 19:23:48 +0000 |
commit | befd99b8e4ae3d2f60761dc9c658f3b6d6576054 (patch) | |
tree | c9d939772b1904cc5a2756dfef1c64ee0133b866 /perllib/FixMyStreet/Geocode.pm | |
parent | 3c6eaa0460dbbc548b896eb0189fdae13596ac12 (diff) |
Various encoding fixing.
Diffstat (limited to 'perllib/FixMyStreet/Geocode.pm')
-rw-r--r-- | perllib/FixMyStreet/Geocode.pm | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/perllib/FixMyStreet/Geocode.pm b/perllib/FixMyStreet/Geocode.pm index 892077d6e..475b2f9bc 100644 --- a/perllib/FixMyStreet/Geocode.pm +++ b/perllib/FixMyStreet/Geocode.pm @@ -9,6 +9,7 @@ package FixMyStreet::Geocode; use strict; +use Encode; use Error qw(:try); use File::Slurp; use File::Path (); @@ -87,8 +88,9 @@ sub geocoded_string_coordinates { # of the site. sub string { my ($s, $q) = @_; + $s = decode_utf8($s); $s = lc($s); - $s =~ s/[^-&0-9a-z ']/ /g; + $s =~ s/[^-&\w ']/ /g; $s =~ s/\s+/ /g; $s = URI::Escape::uri_escape_utf8($s); $s = Cobrand::disambiguate_location(Page::get_cobrand($q), "q=$s", $q); @@ -102,7 +104,7 @@ sub string { } else { $url .= ',+UK' unless $url =~ /united\++kingdom$/ || $url =~ /uk$/i || mySociety::Config::get('COUNTRY') ne 'GB'; - $url .= '&sensor=false&gl=uk&key=' . mySociety::Config::get('GOOGLE_MAPS_API_KEY'); + $url .= '&sensor=false&key=' . mySociety::Config::get('GOOGLE_MAPS_API_KEY'); $js = LWP::Simple::get($url); File::Path::mkpath($cache_dir); File::Slurp::write_file($cache_file, $js) if $js && $js !~ /"code":6[12]0/; |