diff --git a/FHEM/98_SVG.pm b/FHEM/98_SVG.pm
index 937bd308b..6997ccad3 100644
--- a/FHEM/98_SVG.pm
+++ b/FHEM/98_SVG.pm
@@ -1392,6 +1392,17 @@ SVG_getSteps($$$)
return ($step, $mi, $ma);
}
+sub
+SVG_escape($)
+{
+ my ($txt) = @_;
+ $txt =~ s/&/&/g;
+ $txt =~ s/</g;
+ $txt =~ s/>/>/g;
+ $txt =~ s/'/'/g;
+ return $txt;
+}
+
sub
SVG_render($$$$$$$$$$)
{
@@ -1489,9 +1500,7 @@ SVG_render($$$$$$$$$$)
"fill='none' class='border'/>";
my ($off1,$off2) = ($x+$w/2, 3*$y/4);
- my $title = ($conf{title} ? $conf{title} : " ");
- $title =~ s/</g;
- $title =~ s/>/>/g;
+ my $title = SVG_escape($conf{title} ? $conf{title} : " ");
SVG_pO "$title";
@@ -2247,6 +2256,7 @@ SVG_render($$$$$$$$$$)
}
my $style = $conf{lStyle}[$i];
$style =~ s/class="/class="legend /;
+ $desc = SVG_escape($desc);
SVG_pO "$t$desc";