Index: openacs-4/packages/acs-templating/tcl/parse-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/tcl/parse-procs.tcl,v diff -u -r1.48 -r1.48.2.1 --- openacs-4/packages/acs-templating/tcl/parse-procs.tcl 30 Mar 2013 17:53:58 -0000 1.48 +++ openacs-4/packages/acs-templating/tcl/parse-procs.tcl 23 Aug 2013 09:42:27 -0000 1.48.2.1 @@ -553,12 +553,28 @@ # substitute array variable references while {[regsub -all [template::adp_array_variable_regexp_noquote] $code {\1[lang::util::localize $\2(\3)]} code]} {} while {[regsub -all [template::adp_array_variable_regexp_literal] $code {\1$\2(\3)} code]} {} - while {[regsub -all [template::adp_array_variable_regexp] $code {\1[ns_quotehtml [lang::util::localize $\2(\3)]]} code]} {} + # + # Some aolservers have broken implementations of ns_quotehtml + # (returning for the empty string input a one byte output). If this + # happens, we fall back to the "manual" ad_quotehtml. However, we + # prefer to use the faster (C-implemented) ns_quotehtml, since the + # actual subsitutions occur at page-view time, and they are called + # therefore very often. + # + if {[ns_quotehtml ""] eq ""} { + while {[regsub -all [template::adp_array_variable_regexp] $code {\1[ns_quotehtml [lang::util::localize $\2(\3)]]} code]} {} + } else { + while {[regsub -all [template::adp_array_variable_regexp] $code {\1[ad_quotehtml [lang::util::localize $\2(\3)]]} code]} {} + } # substitute simple variable references while {[regsub -all [template::adp_variable_regexp_noquote] $code {\1[lang::util::localize ${\2}]} code]} {} while {[regsub -all [template::adp_variable_regexp_literal] $code {\1${\2}} code]} {} - while {[regsub -all [template::adp_variable_regexp] $code {\1[ns_quotehtml [lang::util::localize ${\2}]]} code]} {} + if {[ns_quotehtml ""] eq ""} { + while {[regsub -all [template::adp_variable_regexp] $code {\1[ns_quotehtml [lang::util::localize ${\2}]]} code]} {} + } else { + while {[regsub -all [template::adp_variable_regexp] $code {\1[ad_quotehtml [lang::util::localize ${\2}]]} code]} {} + } # unescape protected # references # unescape protected @ references