diff options
Diffstat (limited to 'web')
-rwxr-xr-x | web/alert.cgi | 46 | ||||
-rwxr-xr-x | web/index.cgi | 9 | ||||
-rwxr-xr-x | web/reports.cgi | 10 | ||||
-rwxr-xr-x | web/rss.cgi | 2 |
4 files changed, 38 insertions, 29 deletions
diff --git a/web/alert.cgi b/web/alert.cgi index 896ca9ccc..313d55c7d 100755 --- a/web/alert.cgi +++ b/web/alert.cgi @@ -11,6 +11,7 @@ use strict; use Standard; use Digest::SHA1 qw(sha1_hex); +use Encode; use Error qw(:try); use CrossSell; use FixMyStreet::Alert; @@ -110,7 +111,7 @@ sub alert_list { my $areas = mySociety::MaPit::call('point', "4326/$lon,$lat", type => \@types); my $cobrand = Page::get_cobrand($q); my ($success, $error_msg) = Cobrand::council_check($cobrand, { all_councils => $areas }, $q, 'alert'); - if (!$success){ + if (!$success) { return alert_front_page($q, $error_msg); } @@ -128,10 +129,12 @@ sub alert_list { $ward = $_; } } - push @options, [ 'council', $council->{id}, Page::short_name($council->{name}), - sprintf(_("Problems within %s"), $council->{name}) ]; - push @options, [ 'ward', $council->{id}.':'.$ward->{id}, Page::short_name($council->{name}) . '/' - . Page::short_name($ward->{name}), sprintf(_("Problems within %s ward"), $ward->{name}) ]; + my $council_name = encode_utf8($council->{name}); + my $ward_name = encode_utf8($ward->{name}); + push @options, [ 'council', $council->{id}, Page::short_name($council), + sprintf(_("Problems within %s"), $council_name) ]; + push @options, [ 'ward', $council->{id}.':'.$ward->{id}, Page::short_name($council) . '/' + . Page::short_name($ward), sprintf(_("Problems within %s ward"), $ward_name) ]; $options_start = "<div><ul id='rss_feed'>"; $options = alert_list_options($q, @options); @@ -144,8 +147,9 @@ sub alert_list { foreach (values %$areas) { $council = $_; } - push @options, [ 'council', $council->{id}, Page::short_name($council->{name}), - sprintf(_("Problems within %s"), $council->{name}) ]; + my $council_name = encode_utf8($council->{name}); + push @options, [ 'council', $council->{id}, Page::short_name($council), + sprintf(_("Problems within %s"), $council_name) ]; $options_start = "<div><ul id='rss_feed'>"; $options = alert_list_options($q, @options); @@ -166,26 +170,30 @@ sub alert_list { $d_ward = $_; } } + my $district_name = encode_utf8($district->{name}); + my $d_ward_name = encode_utf8($d_ward->{name}); + my $county_name = encode_utf8($county->{name}); + my $c_ward_name = encode_utf8($c_ward->{name}); push @options, - [ 'area', $district->{id}, Page::short_name($district->{name}), $district->{name} ], - [ 'area', $district->{id}.':'.$d_ward->{id}, Page::short_name($district->{name}) . '/' - . Page::short_name($d_ward->{name}), "$d_ward->{name} ward, $district->{name}" ], - [ 'area', $county->{id}, Page::short_name($county->{name}), $county->{name} ], - [ 'area', $county->{id}.':'.$c_ward->{id}, Page::short_name($county->{name}) . '/' - . Page::short_name($c_ward->{name}), "$c_ward->{name} ward, $county->{name}" ]; + [ 'area', $district->{id}, Page::short_name($district), $district_name ], + [ 'area', $district->{id}.':'.$d_ward->{id}, Page::short_name($district) . '/' + . Page::short_name($d_ward), "$d_ward_name ward, $district_name" ], + [ 'area', $county->{id}, Page::short_name($county), $county_name ], + [ 'area', $county->{id}.':'.$c_ward->{id}, Page::short_name($county) . '/' + . Page::short_name($c_ward), "$c_ward_name ward, $county_name" ]; $options_start = '<div id="rss_list">'; $options = $q->p($q->strong(_('Problems within the boundary of:'))) . $q->ul(alert_list_options($q, @options)); @options = (); push @options, - [ 'council', $district->{id}, Page::short_name($district->{name}), $district->{name} ], - [ 'ward', $district->{id}.':'.$d_ward->{id}, Page::short_name($district->{name}) . '/' . Page::short_name($d_ward->{name}), - "$district->{name}, within $d_ward->{name} ward" ]; + [ 'council', $district->{id}, Page::short_name($district), $district_name ], + [ 'ward', $district->{id}.':'.$d_ward->{id}, Page::short_name($district) . '/' . Page::short_name($d_ward), + "$district_name, within $d_ward_name ward" ]; if ($q->{site} ne 'emptyhomes') { push @options, - [ 'council', $county->{id}, Page::short_name($county->{name}), $county->{name} ], - [ 'ward', $county->{id}.':'.$c_ward->{id}, Page::short_name($county->{name}) . '/' - . Page::short_name($c_ward->{name}), "$county->{name}, within $c_ward->{name} ward" ]; + [ 'council', $county->{id}, Page::short_name($county), $county_name ], + [ 'ward', $county->{id}.':'.$c_ward->{id}, Page::short_name($county) . '/' + . Page::short_name($c_ward), "$county_name, within $c_ward_name ward" ]; $options .= $q->p($q->strong(_('Or problems reported to:'))) . $q->ul(alert_list_options($q, @options)); $options_end = $q->p($q->small(_('FixMyStreet sends different categories of problem diff --git a/web/index.cgi b/web/index.cgi index 758ca8c50..189231682 100755 --- a/web/index.cgi +++ b/web/index.cgi @@ -9,6 +9,7 @@ use strict; use Standard; use Utils; +use Encode; use Error qw(:try); use File::Slurp; use LWP::Simple; @@ -629,7 +630,7 @@ If this is not the correct location, simply click on the map again. ')); $vars{page_heading} = $q->h1(_('Reporting a problem')); if ($details eq 'all') { - my $council_list = join('</strong> or <strong>', map { $_->{name} } values %$all_councils); + my $council_list = join('</strong> or <strong>', map { encode_utf8($_->{name}) } values %$all_councils); if ($q->{site} eq 'emptyhomes'){ $vars{text_help} = '<p>' . sprintf(_('All the information you provide here will be sent to <strong>%s</strong>. On the site, we will show the subject and details of the problem, plus your @@ -648,9 +649,9 @@ name if you give us permission.'), $council_list); push @missing, $_ unless $councils{$_}; } my $n = @missing; - my $list = join(' or ', map { $all_councils->{$_}->{name} } @missing); + my $list = join(' or ', map { encode_utf8($all_councils->{$_}->{name}) } @missing); $vars{text_help} = '<p>All the information you provide here will be sent to <strong>' - . join('</strong> or <strong>', map { $all_councils->{$_}->{name} } @councils) + . join('</strong> or <strong>', map { encode_utf8($all_councils->{$_}->{name}) } @councils) . '</strong>. The subject and details of the problem will be public, plus your name if you give us permission.'; $vars{text_help} .= ' We do <strong>not</strong> yet have details for the other council'; @@ -661,7 +662,7 @@ problems for $list and emailing it to us at <a href='mailto:$e'>$e</a>."; . '|' . join(',', @missing) . '">'; } else { my $e = Cobrand::contact_email($cobrand); - my $list = join(' or ', map { $_->{name} } values %$all_councils); + my $list = join(' or ', map { encode_utf8($_->{name}) } values %$all_councils); my $n = scalar keys %$all_councils; if ($q->{site} ne 'emptyhomes') { $vars{text_help} = '<p>We do not yet have details for the council'; diff --git a/web/reports.cgi b/web/reports.cgi index 3ac22b0ce..12e3a3014 100755 --- a/web/reports.cgi +++ b/web/reports.cgi @@ -130,7 +130,7 @@ sub main { } my $type = 'council_problems'; # Problems sent to a council my (@params, %title_params); - $title_params{COUNCIL} = $area_name; + $title_params{COUNCIL} = encode_utf8($area_name); push @params, $one_council->{id} if $rss eq 'reports'; push @params, $ward ? $ward->{id} : $one_council->{id}; if ($ward && $rss eq 'reports') { @@ -208,9 +208,9 @@ sub main { my $url = Page::short_name($areas_info->{$_}, $areas_info); my $cobrand_url = Cobrand::url($cobrand, "/reports/$url", $q); print '><td align="left"><a href="' . $cobrand_url . '">' . - $areas_info->{$_}->{name}; - if ($areas_info->{$_}->{parent_area} && $url =~ /,/) { - print ', ' . $areas_info->{$areas_info->{$_}->{parent_area}}->{name}; + encode_utf8($areas_info->{$_}->{name}); + if ($areas_info->{$_}->{parent_area} && $url =~ /,|%2C/) { + print ', ' . encode_utf8($areas_info->{$areas_info->{$_}->{parent_area}}->{name}); } print '</a></td>'; summary_cell(\@{$open{$_}{new}}); @@ -229,7 +229,7 @@ sub main { } print '</table>'; } else { - my $name = $one_council->{name}; + my $name = encode_utf8($one_council->{name}); if (!$name) { print Page::header($q, title=>_("Summary reports")); print "Council with identifier " . ent($one_council->{id}). " not found. "; diff --git a/web/rss.cgi b/web/rss.cgi index 6ba23abe2..5c2d3701e 100755 --- a/web/rss.cgi +++ b/web/rss.cgi @@ -46,7 +46,7 @@ sub main { my $id = $q->param('id'); my $va_info = mySociety::MaPit::call('area', $id); my $qs = '/'.$id; - $out = FixMyStreet::Alert::generate_rss($type, $xsl, $qs, [$id], { NAME => $va_info->{name} }, $cobrand, $q); + $out = FixMyStreet::Alert::generate_rss($type, $xsl, $qs, [$id], { NAME => encode_utf8($va_info->{name}) }, $cobrand, $q); } elsif ($type eq 'all_problems') { $out = FixMyStreet::Alert::generate_rss($type, $xsl, '', undef, undef, $cobrand, $q); } else { |