From d97936e258b93abb024e3fe316affe0062373fe9 Mon Sep 17 00:00:00 2001 From: Chris Date: Sun, 15 Jul 2018 18:39:27 +0100 Subject: [PATCH] Allow deactivation of html entity escape in validate_string --- Webperl/Block.pm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Webperl/Block.pm b/Webperl/Block.pm index cdfcdad..e94821d 100644 --- a/Webperl/Block.pm +++ b/Webperl/Block.pm @@ -143,6 +143,8 @@ sub get_enum_values { # string does not match the regexp, validation fails. # formatdesc - Must be provided if formattest is provided. A description of why not # matching formattest fails the validation. +# encode - if set to true, html characters are escaped, otherwise they are passed +# back 'as is'. Defaults to true # # @param param The name of the cgi parameter to check. # @param settings A reference to a hash of settings to control the validation @@ -185,7 +187,8 @@ sub validate_string { if($formattest && $text !~ /$formattest/); # Convert all characters in the string to safe versions - $text = encode_entities($text); + $text = encode_entities($text) + unless(defined($settings -> {"encode"}) && !$settings -> {"encode"}); # Convert horrible smart quote crap from windows foreach my $char (keys(%{$self -> {"template"} ->{"entities"}})) {