X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FHTML%2FUtil.pm;h=f68fb0a1f8d93cf04a4f46bd722eadba0d7134d1;hb=b2bedb6b5eff41a17ddb194df1c75213b841f3bb;hp=ed5ffdec9bf9f84fa5de484bae1923e171582285;hpb=ad06ed73b3e1d5932d874ef389daa109307db723;p=kivitendo-erp.git diff --git a/SL/HTML/Util.pm b/SL/HTML/Util.pm index ed5ffdec9..f68fb0a1f 100644 --- a/SL/HTML/Util.pm +++ b/SL/HTML/Util.pm @@ -7,9 +7,11 @@ use HTML::Parser; my %stripper; my %entities = ( - 'lt' => '<', - 'gt' => '>', - 'amp' => '&', + 'lt' => '<', + 'gt' => '>', + 'amp' => '&', + 'nbsp' => ' ', # should be => "\x{00A0}", but this can lead to problems with + # a non-visible character in csv-exports for example ); sub strip { @@ -17,7 +19,10 @@ sub strip { my $value = !ref($class_or_value) && (($class_or_value // '') eq 'SL::HTML::Util') ? $_[1] : $class_or_value; - return '' unless $value; + return '' unless defined $value; + + # Remove HTML comments. + $value =~ s{ }{}gx; if (!%stripper) { %stripper = ( parser => HTML::Parser->new );