diff options
author | Matthew Somerville <matthew-github@dracos.co.uk> | 2017-10-02 15:49:49 +0100 |
---|---|---|
committer | Matthew Somerville <matthew-github@dracos.co.uk> | 2017-10-02 17:32:19 +0100 |
commit | 6f43693cfc58d5356fafd231f2a232eb2fd99ae5 (patch) | |
tree | 95a53be84267dfeb9a4378574c6bd5988fc3409d /perllib/FixMyStreet/App/Controller/Rss.pm | |
parent | 8e9cd7cdb0a0f0fe591c2ecc25ae480fa0a5f799 (diff) |
In RSS, only escape the necessary five/ctrl chars.
By default encode_entities uses named entities, which don't exist
by default in XML. It seemed nicer to switch to only escaping the
minimum rather than switching to numeric entities.
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/Rss.pm')
-rwxr-xr-x | perllib/FixMyStreet/App/Controller/Rss.pm | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Rss.pm b/perllib/FixMyStreet/App/Controller/Rss.pm index 3497ad0e1..7cf4783c0 100755 --- a/perllib/FixMyStreet/App/Controller/Rss.pm +++ b/perllib/FixMyStreet/App/Controller/Rss.pm @@ -3,7 +3,7 @@ package FixMyStreet::App::Controller::Rss; use Moose; use namespace::autoclean; use POSIX qw(strftime); -use HTML::Entities; +use HTML::Entities qw(); use URI::Escape; use XML::RSS; @@ -28,6 +28,10 @@ Catalyst Controller. =cut +sub encode_entities { + HTML::Entities::encode_entities($_[0], '\x00-\x1f\x7f<>&"\''); +} + sub updates : LocalRegex('^(\d+)$') { my ( $self, $c ) = @_; |