[LON-CAPA-cvs] cvs: loncom /interface/spreadsheet Spreadsheet.pm
matthew
lon-capa-cvs@mail.lon-capa.org
Tue, 26 Aug 2003 19:14:06 -0000
matthew Tue Aug 26 15:14:06 2003 EDT
Modified files:
/loncom/interface/spreadsheet Spreadsheet.pm
Log:
HTML::Entities::encode does not encode backslash. How annoying.
Do it ourselves to make sure formulas come up properly when editing
spreadsheet cells.
Index: loncom/interface/spreadsheet/Spreadsheet.pm
diff -u loncom/interface/spreadsheet/Spreadsheet.pm:1.20 loncom/interface/spreadsheet/Spreadsheet.pm:1.21
--- loncom/interface/spreadsheet/Spreadsheet.pm:1.20 Fri Aug 1 09:47:26 2003
+++ loncom/interface/spreadsheet/Spreadsheet.pm Tue Aug 26 15:14:06 2003
@@ -1,5 +1,5 @@
#
-# $Id: Spreadsheet.pm,v 1.20 2003/08/01 13:47:26 matthew Exp $
+# $Id: Spreadsheet.pm,v 1.21 2003/08/26 19:14:06 matthew Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1217,7 +1217,9 @@
#
# The encoding string "^A-blah" is placed in []'s inside a regexp, so
# we specify the characters we want left alone by putting a '^' in front.
- $formula = &HTML::Entities::encode($formula,"^A-z0-9 !#\$%-;=?~");
+ $formula = &HTML::Entities::encode($formula,'^A-z0-9 !#$%-;=?~');
+ # HTML::Entities::encode does not catch everything - we need '\' encoded
+ $formula =~ s/\\/&\#092/g;
# Escape it again - this time the only encodable character is '&'
$formula =~ s/\&/\&/g;
# Glue everything together