--- loncom/homework/default_homework.lcpm 2003/02/10 21:41:25 1.56 +++ loncom/homework/default_homework.lcpm 2003/02/12 22:45:01 1.57 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # used by lonxml::xmlparse() as input variable $safeinit to Apache::run::run() # -# $Id: default_homework.lcpm,v 1.56 2003/02/10 21:41:25 albertel Exp $ +# $Id: default_homework.lcpm,v 1.57 2003/02/12 22:45:01 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -152,6 +152,8 @@ sub get_array_args { sub caparesponse_check_list { my ($response,$expr)=@_; my $result; + $expr =~ s/\\/\\\\/g; + $expr =~ s/\'/\\\'/g; my ($result,@list) = &get_array_args($expr,'answer'); my $aresult=''; my $current_answer; @@ -180,12 +182,15 @@ sub caparesponse_check_list { my $awards=''; for ($i=0; $i<@list;$i++) { $result.="trying answer :$list[$i]:\n"; + my $thisanswer=$list[$i]; + $thisanswer=~ s/\\/\\\\/g; + $thisanswer =~ s/\'/\\\'/g; if ($unit eq '') { $aresult=&caparesponse_check($responselist[$i], - $expr.';my $answer=\''.$list[$i].'\';'); + $expr.';my $answer=\''.$thisanswer.'\';'); } else { $aresult=&caparesponse_check($responselist[$i]." $unit", - $expr.';my $answer=\''.$list[$i].'\';'); + $expr.';my $answer=\''.$thisanswer.'\';'); } my ($temp)=split /:/, $aresult; $awards.="$temp,";