oalders / html-restrict

HTML::Restrict - Strip away unwanted HTML tags
Other
10 stars 9 forks source link

process() method is html-encoding the return value #38

Closed evanroberts-foundant closed 2 years ago

evanroberts-foundant commented 5 years ago

Sometime between version 2.3.0 and 3.0.0 the process() method is html-encoding the return value (at least in some cases).

use HTML::Restrict; my $scrubber = HTML::Restrict->new();

in 2.3.0 this results in '&' being printed

in 3.0.0 this results in '& ' being printed (&-a-m-p-;)

print $scrubber->process('&');

This makes it impossible to use it in a use-case where plain text is being processed for html tags. We are using it to strip html out of otherwise valid text. html-encoding & breaks the data since we expect the output to be pure-text.

oalders commented 5 years ago

It looks like https://github.com/oalders/html-restrict/pull/37#issuecomment-470614396 could have used more discussion. You could decode HTML entities on the output, but I think we could just add a new option encode_entities which would default to 1, but could be disabled at object instantiation. That would allow you to preserve the old behaviour. Does that work for you? Thoughts on this @haarg?

oalders commented 2 years ago

Closed via https://github.com/oalders/html-restrict/commit/6faffe57874f2f94a871bedea9e32b57356c92cc