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 -r1.67.2.24 -r1.67.2.25 --- openacs-4/packages/acs-tcl/tcl/text-html-procs.tcl 15 Jan 2017 19:54:59 -0000 1.67.2.24 +++ openacs-4/packages/acs-tcl/tcl/text-html-procs.tcl 13 Feb 2017 13:44:50 -0000 1.67.2.25 @@ -37,9 +37,10 @@ @creation-date 19 July 2000 } { if { $text eq "" } { - return {} + return "" } + set space_added 0 set nr_links 0 if { !$no_links_p } { # @@ -48,6 +49,7 @@ # beginning of the text. # set text " $text" + set space_added 1 # if something is " http://" or " https://" or "ftp://" we # assume it is a link to an outside source. @@ -122,6 +124,8 @@ # Convert line breaks if { !$no_lines_p } { set text [util_convert_line_breaks_to_html -includes_html=$includes_html_p -- $text] + # the function strips all leading white space + set space_added 0 } if { !$no_quote_p } { @@ -144,8 +148,6 @@ # regsub -all {\u0002([^\u0003]+?)\u0003} $text {\1} text - set text [string trimleft $text] - set changed_back [regsub -all {(\u0002|\u0003)} $text {} text] if {$includes_html_p} { # @@ -161,6 +163,10 @@ } } + if {$space_added} { + set text [string range $text 1 end] + } + return $text } Index: openacs-4/packages/acs-tcl/tcl/test/html-conversion-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/test/html-conversion-procs.tcl,v diff -u -r1.10.8.3 -r1.10.8.4 --- openacs-4/packages/acs-tcl/tcl/test/html-conversion-procs.tcl 26 Sep 2015 11:25:23 -0000 1.10.8.3 +++ openacs-4/packages/acs-tcl/tcl/test/html-conversion-procs.tcl 13 Feb 2017 13:44:50 -0000 1.10.8.4 @@ -93,7 +93,7 @@ set string "What?\nNever mind, buddy" aa_equals "" [ad_html_text_convert -from "text/plain" -to "text/html" -truncate_len 14 -- $string] \ - [ad_text_to_html "What?\nNever..."] + "What?
\nNever..." aa_equals "" [ad_html_text_convert -from "text/plain" -to "text/plain" -truncate_len 14 -- $string] \ "What?\nNever..."