aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--perllib/FixMyStreet/Template.pm2
-rw-r--r--t/app/controller/alert_new.t2
2 files changed, 4 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/Template.pm b/perllib/FixMyStreet/Template.pm
index bc087de9a..afb977ac9 100644
--- a/perllib/FixMyStreet/Template.pm
+++ b/perllib/FixMyStreet/Template.pm
@@ -175,6 +175,7 @@ sub email_sanitize_text : Fn('email_sanitize_text') {
my $text = $update->{item_text};
my $extra = $update->{item_extra};
+ utf8::encode($extra) if $extra;
$extra = $extra ? RABX::wire_rd(new IO::String($extra)) : {};
my $staff = $extra->{is_superuser} || $extra->{is_body_user};
@@ -234,6 +235,7 @@ sub email_sanitize_html : Fn('email_sanitize_html') {
my $text = $update->{item_text};
my $extra = $update->{item_extra};
+ utf8::encode($extra) if $extra;
$extra = $extra ? RABX::wire_rd(new IO::String($extra)) : {};
my $staff = $extra->{is_superuser} || $extra->{is_body_user};
diff --git a/t/app/controller/alert_new.t b/t/app/controller/alert_new.t
index 31d8c52ed..562b173c8 100644
--- a/t/app/controller/alert_new.t
+++ b/t/app/controller/alert_new.t
@@ -1,3 +1,4 @@
+use utf8;
use FixMyStreet::TestMech;
use FixMyStreet::Script::Alerts;
@@ -880,6 +881,7 @@ subtest 'check staff updates can include sanitized HTML' => sub {
my $update1 = $mech->create_comment_for_problem($report, $user2, 'Staff User', '<p>This is some update text with <strong>HTML</strong> and *italics*.</p> <ul><li>Even a list</li><li>Which might work</li><li>In the <a href="https://www.fixmystreet.com/">text</a> part</li></ul> <script>not allowed</script>', 't', 'confirmed', undef, { confirmed => $r_dt->clone->add( minutes => 8 ) });
$update1->set_extra_metadata(is_body_user => $user2->from_body->id);
+ $update1->set_extra_metadata(something_unicodey => "The cafɇ is here");
$update1->update;
$mech->create_comment_for_problem($report, $user3, 'Updater User', 'Public users <i>cannot</i> use HTML. <script>not allowed</script>', 't', 'confirmed', undef, { confirmed => $r_dt->clone->add( minutes => 9 ) });