Index: openacs-4/packages/acs-tcl/tcl/text-html-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/text-html-procs.tcl,v
diff -u -N -r1.107 -r1.108
--- openacs-4/packages/acs-tcl/tcl/text-html-procs.tcl 14 Dec 2018 15:11:53 -0000 1.107
+++ openacs-4/packages/acs-tcl/tcl/text-html-procs.tcl 14 Dec 2018 20:15:40 -0000 1.108
@@ -1365,17 +1365,19 @@
@author Antonio Pisano
} {
+ string map [list \n \\n \b \\b \f \\f \r \\r \t \\t \v \\v \" {\"} ' {\'}] $string
+
# Escape quotes and backslashes (non greedy)
- regsub -all {.??([^\\])?('|\"|\\)} $string {\1\\\2} string
+ #regsub -all {.??([^\\])?('|\"|\\)} $string {\1\\\2} string
# Escape characters are replaced with their escape sequence
- regsub -all {\b} $string {\\b} string
- regsub -all {\f} $string {\\f} string
- regsub -all {\n} $string {\\n} string
- regsub -all {\r} $string {\\r} string
- regsub -all {\t} $string {\\t} string
- regsub -all {\v} $string {\\v} string
+ #regsub -all {\b} $string {\\b} string
+ #regsub -all {\f} $string {\\f} string
+ #regsub -all {\n} $string {\\n} string
+ #regsub -all {\r} $string {\\r} string
+ #regsub -all {\t} $string {\\t} string
+ #regsub -all {\v} $string {\\v} string
- return $string
+ #return $string
}
####################
Index: openacs-4/packages/acs-tcl/tcl/test/text-html-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/test/text-html-procs.tcl,v
diff -u -N -r1.10 -r1.11
--- openacs-4/packages/acs-tcl/tcl/test/text-html-procs.tcl 14 Dec 2018 15:11:54 -0000 1.10
+++ openacs-4/packages/acs-tcl/tcl/test/text-html-procs.tcl 14 Dec 2018 20:15:40 -0000 1.11
@@ -221,12 +221,19 @@
set string "\"\"\"\"\"\'"
aa_true " - String of only quotes " {[ad_js_escape $string] eq {\"\"\"\"\"\'}}
- set string "\n\r\t \n\n\n \t\t \b \v\v\v \f"
- aa_true " - String of only escape sequences " {[ad_js_escape $string] eq {\n\r\t \n\n\n \t\t \b \v\v\v \f}}
+ set string "\n\r\t \n\n\n \t\t \b \v\v\v \f"
+ set expected {\n\r\t \n\n\n \t\t \b \v\v\v \f}
+
+ aa_true " - String of only escape sequences " {[ad_js_escape $string] eq $expected}
- set string "\n\r\t \na word \'\n\n \t\t\"\" aaaaaa\' \'\'\'\b \v\v\v \f"
+ set string "\n\r\t \na word \'\n\n \t\"\" aaaaa\' \'\'\'\b \v\v\v \f"
+ set expected {\n\r\t \na word \'\n\n \t\"\" aaaaa\' \'\'\'\b \v\v\v \f}
+
+ ns_log notice EXP:<$expected>
+ ns_log notice GOT:<[ad_js_escape $string]>
+
aa_true " - String of escape sequences, quotes and text (with some quotes already escaped)" \
- {[ad_js_escape $string] eq {\n\r\t \na word \'\n\n \t\"\" aaaaa\' \'\'\'\b \v\v\v \f}}
+ {[ad_js_escape $string] eq $expected}
}
aa_register_case \