From befd99b8e4ae3d2f60761dc9c658f3b6d6576054 Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Wed, 16 Feb 2011 19:23:48 +0000 Subject: Various encoding fixing. --- perllib/Problems.pm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'perllib/Problems.pm') diff --git a/perllib/Problems.pm b/perllib/Problems.pm index 8c6eeccad..ff222f874 100644 --- a/perllib/Problems.pm +++ b/perllib/Problems.pm @@ -93,12 +93,14 @@ sub recent_photos { my $key = "recent_photos:$site_key:$num:$lat:$lon:$dist"; $probs = Memcached::get($key); unless ($probs) { - $probs = select_all("select id, title + $probs = mySociety::Locale::in_gb_locale { + select_all("select id, title from problem_find_nearby(?, ?, ?) as nearby, problem where nearby.problem_id = problem.id and state in ('confirmed', 'fixed') and photo is not null $site_restriction order by confirmed desc limit $num", $lat, $lon, $dist); + }; Memcached::set($key, $probs, 3600); } } else { @@ -259,7 +261,7 @@ sub problems_matching_criteria { my $areas_info = mySociety::MaPit::call('areas', \@councils); foreach my $problem (@$problems){ if ($problem->{council}) { - my @council_names = map { $areas_info->{$_}->{name}} @{$problem->{council}} ; + my @council_names = map { encode_utf8($areas_info->{$_}->{name}) } @{$problem->{council}} ; $problem->{council} = join(' and ', @council_names); } } -- cgit v1.2.3 From 3910b9b80463f9e133e5a61422ef1f22c677da18 Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Thu, 17 Feb 2011 11:07:25 +0000 Subject: Some missing use Encodes. --- perllib/Problems.pm | 1 + 1 file changed, 1 insertion(+) (limited to 'perllib/Problems.pm') diff --git a/perllib/Problems.pm b/perllib/Problems.pm index ff222f874..7b37fe7d7 100644 --- a/perllib/Problems.pm +++ b/perllib/Problems.pm @@ -12,6 +12,7 @@ package Problems; use strict; +use Encode; use Memcached; use mySociety::DBHandle qw/dbh select_all/; use mySociety::Locale; -- cgit v1.2.3 From aca40d6e5da5736515748fc33ff100d9d2b2ee55 Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Mon, 21 Feb 2011 12:00:29 +0000 Subject: Remove all encodes, they now cause double-encoding. --- perllib/Problems.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'perllib/Problems.pm') diff --git a/perllib/Problems.pm b/perllib/Problems.pm index 7b37fe7d7..127d88a30 100644 --- a/perllib/Problems.pm +++ b/perllib/Problems.pm @@ -262,7 +262,7 @@ sub problems_matching_criteria { my $areas_info = mySociety::MaPit::call('areas', \@councils); foreach my $problem (@$problems){ if ($problem->{council}) { - my @council_names = map { encode_utf8($areas_info->{$_}->{name}) } @{$problem->{council}} ; + my @council_names = map { $areas_info->{$_}->{name} } @{$problem->{council}} ; $problem->{council} = join(' and ', @council_names); } } -- cgit v1.2.3