From 5de9f9f8e33b1fe8ab69cf38bc58d74cbec81779 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Tue, 1 Apr 2014 13:47:03 +0200 Subject: [PATCH] =?utf8?q?SL::HTML::Util::strip:=20HTML-Entit=C3=A4ten=20z?= =?utf8?q?ur=C3=BCck=C3=BCbersetzen?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/HTML/Util.pm | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/SL/HTML/Util.pm b/SL/HTML/Util.pm index 7212d646f..0b2e630d0 100644 --- a/SL/HTML/Util.pm +++ b/SL/HTML/Util.pm @@ -6,6 +6,11 @@ use warnings; use HTML::Parser; my %stripper; +my %entities = ( + 'lt' => '<', + 'gt' => '>', + 'amp' => '&', +); sub strip { my ($class_or_value) = @_; @@ -22,6 +27,8 @@ sub strip { $stripper{parser}->parse($value); $stripper{parser}->eof; + $stripper{text} =~ s{\&([^;]+);}{ $entities{$1} }eg; + return delete $stripper{text}; } -- 2.20.1