From 453fe9d30931ede7e2a9806caa367595f29cee25 Mon Sep 17 00:00:00 2001 From: Michal Vaner Date: Thu, 4 Sep 2008 17:19:04 +0200 Subject: [PATCH] Fix escaping of characters in stock answers --- PciIds/Html/Admin.pm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/PciIds/Html/Admin.pm b/PciIds/Html/Admin.pm index c539686..e90b7a9 100644 --- a/PciIds/Html/Admin.pm +++ b/PciIds/Html/Admin.pm @@ -72,8 +72,8 @@ sub loadStock() { while( defined( $text = ) ) { chomp $text; last if $text eq ''; - $lines .= '
' if $lines ne ''; - $lines .= encode( $text ); + $lines .= "\n" if $lines ne ''; + $lines .= $text; } push @stock, [ encode( $name ), $lines ]; } @@ -110,6 +110,8 @@ sub genNewAdminForm( $$$$$ ) { print "function answers() {\nreturn new Array( \"\" "; foreach( @{$stock} ) { my( $x, $text ) = @{$_}; + $text =~ s/"/\\"/g; + $text =~ s/\n/\\n/g; print ', "'.$text.'"'; } print ");\n}\n"; -- 2.39.5