[LON-CAPA-cvs] cvs: loncom /homework structuretags.pm

droeschl droeschl at source.lon-capa.org
Fri Apr 10 08:01:28 EDT 2015


droeschl		Fri Apr 10 12:01:28 2015 EDT

  Modified files:              
    /loncom/homework	structuretags.pm 
  Log:
  Inserting snippets using the 'Insert Menu' from UTF-8 encoded template files now works as intended.
  
  
Index: loncom/homework/structuretags.pm
diff -u loncom/homework/structuretags.pm:1.533 loncom/homework/structuretags.pm:1.534
--- loncom/homework/structuretags.pm:1.533	Fri Apr 10 08:22:21 2015
+++ loncom/homework/structuretags.pm	Fri Apr 10 12:01:28 2015
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # definition of tags that give a structure to a document
 #
-# $Id: structuretags.pm,v 1.533 2015/04/10 08:22:21 droeschl Exp $
+# $Id: structuretags.pm,v 1.534 2015/04/10 12:01:28 droeschl Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -811,14 +811,14 @@
         foreach my $title (sort @{$tmplthash{$cat}}) {
             my $path = $tmpltcontent{$title}->[0];
             my $code;
-            open(FH, "<:encoding(UTF-8)", $path);
+            open(FH, "<$path");
             while(<FH>){
                 $code.= $_ unless $_ =~ /(<problem>)|(<\/problem>)/;
             }
             close(FH);
 
 			if ($code ne '') {				
-				my $href = 'javascript:insertText(\'' . &convert_for_js(&HTML::Entities::encode($code)) . '\')';
+                my $href = 'javascript:insertText(\'' . &convert_for_js(&HTML::Entities::encode($code,'<>&"')) . '\')';
 				my $currItem = [$href, $title, undef];
 				push @{$catItems}, $currItem;
 			}




More information about the LON-CAPA-cvs mailing list