diff options
author | Matthew Somerville <matthew@fury.ukcod.org.uk> | 2011-02-22 15:26:51 +0000 |
---|---|---|
committer | Matthew Somerville <matthew@fury.ukcod.org.uk> | 2011-02-22 15:26:51 +0000 |
commit | e3c8c5d194a7a7dce70152f89c65616c8981c1a3 (patch) | |
tree | 281183e4345f8d9a400c4b651140f4055635a375 | |
parent | 3c97d45cb1a3803e74c43ef3eca3beb4a5d3ed23 (diff) |
Couple of URI escaping fixes, plus cope with different versions of LWP returning content/decoded_content.
-rw-r--r-- | perllib/Cobrands/Barnet/Util.pm | 2 | ||||
-rw-r--r-- | perllib/FixMyStreet/Geocode.pm | 1 | ||||
-rw-r--r-- | perllib/Page.pm | 2 | ||||
-rwxr-xr-x | web/index.cgi | 3 |
4 files changed, 4 insertions, 4 deletions
diff --git a/perllib/Cobrands/Barnet/Util.pm b/perllib/Cobrands/Barnet/Util.pm index eb8b91649..8ce296aaf 100644 --- a/perllib/Cobrands/Barnet/Util.pm +++ b/perllib/Cobrands/Barnet/Util.pm @@ -79,7 +79,7 @@ sub council_check { } my $url = 'http://www.fixmystreet.com/'; $url .= 'alert' if $context eq 'alert'; - $url .= '?pc=' . URI::Escape::uri_escape($q->param('pc')) if $q->param('pc'); + $url .= '?pc=' . URI::Escape::uri_escape_utf8($q->param('pc')) if $q->param('pc'); my $error_msg = "That location is not covered by Barnet. Please visit <a href=\"$url\">the main FixMyStreet site</a>."; return (0, $error_msg); diff --git a/perllib/FixMyStreet/Geocode.pm b/perllib/FixMyStreet/Geocode.pm index 17a4d8539..803e32a85 100644 --- a/perllib/FixMyStreet/Geocode.pm +++ b/perllib/FixMyStreet/Geocode.pm @@ -106,6 +106,7 @@ sub string { || mySociety::Config::get('COUNTRY') ne 'GB'; $url .= '&sensor=false&key=' . mySociety::Config::get('GOOGLE_MAPS_API_KEY'); $js = LWP::Simple::get($url); + $js = encode_utf8($js) if utf8::is_utf8($js); File::Path::mkpath($cache_dir); File::Slurp::write_file($cache_file, $js) if $js && $js !~ /"code":6[12]0/; } diff --git a/perllib/Page.pm b/perllib/Page.pm index 447d9eda2..68a027e4b 100644 --- a/perllib/Page.pm +++ b/perllib/Page.pm @@ -305,7 +305,7 @@ sub footer { my ($q, %params) = @_; my $pc = $q->param('pc') || ''; - $pc = '?pc=' . URI::Escape::uri_escape($pc) if $pc; + $pc = '?pc=' . URI::Escape::uri_escape_utf8($pc) if $pc; my $creditline = _('Built by <a href="http://www.mysociety.org/">mySociety</a>, using some <a href="http://github.com/mysociety/fixmystreet">clever</a> <a href="https://secure.mysociety.org/cvstrac/dir?d=mysociety/services/TilMa">code</a>.'); if (mySociety::Config::get('COUNTRY') eq 'NO') { diff --git a/web/index.cgi b/web/index.cgi index 07cb74f6b..b3c31585e 100755 --- a/web/index.cgi +++ b/web/index.cgi @@ -12,7 +12,6 @@ use Utils; use Encode; use Error qw(:try); use File::Slurp; -use LWP::Simple; use RABX; use CGI::Carp; use URI::Escape; @@ -945,7 +944,7 @@ sub display_location { my $rss_url; if ($pc_h) { - $rss_url = "/rss/pc/" . URI::Escape::uri_escape($pc_h); + $rss_url = "/rss/pc/" . URI::Escape::uri_escape_utf8($pc_h); } else { $rss_url = "/rss/l/$short_lat,$short_lon"; } |