nigelm/html-scrubber — Issue #1: escaping of < and >
Author: myrrhlin
Created: 2011-11-15 16:48:11+00:00
State: open

hi nigel,

$ perl -MHTML::Scrubber -e '$s=HTML::Scrubber->new(); print $s->scrub(qq[ Y U escape > & <, HTML::Scrubber? \n])'
Y U escape > & <, HTML::Scrubber?

this behavior caused me trouble. people often use > for quoting in, e.g., email.

i am not the only one who's had this issue:
https://rt.cpan.org/Public/Bug/Display.html?id=69947

it's debatable whether this behavior is "correct" : HTML::Scrubber is used to remove HTML tags of various kinds -- but here it's escaping an entity that, although it might confuse some parser, is not part of any HTML. there appears no option to turn off this behavior.

the guilty lines appear to be 440-441:
$text =~ s//>/g;

The comment suggests this behavior was added to address some issue.

In the changelog for HTML::Scrubber, there is the following:
0.03 Mon Jul 21 07:32:10 2003
- closed http://rt.cpan.org/NoAuth/Bug.html?id=2969
now escape spurious >< in text

I searched for the relevant RT ticket to understand why this change was made, but couldn't find it. It's not 8716, 10332, or 2969.

good luck.

michael