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.46.2.1 -r1.46.2.2
--- openacs-4/packages/acs-tcl/tcl/text-html-procs.tcl 5 Jun 2005 21:27:40 -0000 1.46.2.1
+++ openacs-4/packages/acs-tcl/tcl/text-html-procs.tcl 1 Nov 2006 19:04:05 -0000 1.46.2.2
@@ -19,6 +19,7 @@
-no_lines:boolean
-no_quote:boolean
-includes_html:boolean
+ -encode:boolean
text
} {
Converts plaintext to html. Also translates any recognized
@@ -29,6 +30,7 @@
semi-HTML input and preserve that formatting. This will also cause spaces/tabs to not be
replaced with nbsp's, because this can too easily mess up HTML tags.
@param includes_html Set this if the text parameter already contains some HTML which should be preserved.
+ @param encode This will encode international characters into it's html equivalent, like "�" into ü
@author Branimir Dolicki (branimir@arsdigita.com)
@author Lars Pind (lars@pinds.com)
@@ -77,6 +79,32 @@
set text [ad_quotehtml $text]
}
+ if { $encode_p} {
+ set myChars {
+ � � � � � � � � � �
+ � � � � � � � � � �
+ � � � � � � � � � �
+ � � � � � � � � � �
+ � � � � � � � � � �
+ � � � � � � � � � �
+ � � � � �
+ }
+
+ set myHTML {
+ ª º À Á Â Ã Ä Å &Aelig; Ç
+ È É Ê Ë Ì Í Î Ï Ð Ñ
+ Ò Ó Ô Õ Ö Ø Ù Ú Û Ü
+ Ý Þ ß à á â ã ä å æ
+ ç è é ê ë ì í î ï ð
+ ñ ò ó ô õ ö ø ù ú û
+ ü ý þ ÿ ¿
+ }
+
+ for { set i 0 } { $i < [ llength $myChars ] } { incr i } {
+ set text [ string map "[ lindex $myChars $i ] [ lindex $myHTML $i ]" $text ]
+ }
+ }
+
# Convert line breaks
if { !$no_lines_p } {
set text [util_convert_line_breaks_to_html -includes_html=$includes_html_p -- $text]
@@ -984,6 +1012,34 @@
append output(text) "\n\n[join $href_urls "\n"]"
}
+ #---
+ # conversion like in ad_text_to_html
+ # 2006/09/12
+ set myChars {
+ � � � � � � � � � �
+ � � � � � � � � � �
+ � � � � � � � � � �
+ � � � � � � � � � �
+ � � � � � � � � � �
+ � � � � � � � � � �
+ � � � � �
+ }
+
+ set myHTML {
+ ª º À Á Â Ã Ä Å &Aelig; Ç
+ È É Ê Ë Ì Í Î Ï Ð Ñ
+ Ò Ó Ô Õ Ö Ø Ù Ú Û Ü
+ Ý Þ ß à á â ã ä å æ
+ ç è é ê ë ì í î ï ð
+ ñ ò ó ô õ ö ø ù ú û
+ ü ý þ ÿ ¿
+ }
+
+ for { set i 0 } { $i < [ llength $myHTML ] } { incr i } {
+ set output(text) [ string map "[ lindex $myHTML $i ] [ lindex $myChars $i ]" $output(text) ]
+ }
+ #---
+
return $output(text)
}