[Bese-devel] recent write-as-html patch

Aleksandar Bakic a_bakic at yahoo.com
Sun Feb 19 21:21:46 UTC 2006


Hi,

It seems that the last five added lines should not be added (as-is):

--- src/http.lisp       2006-02-19 21:39:46.000000000 +0100
+++ ../tmp/arnesi_dev/src/http.lisp     2006-02-19 12:40:46.000000000 +0100
@@ -86,6 +86,7 @@
 (defun write-as-html (string &key (stream t) (escape-whitespace nil))
   (loop
      for char across string
+     for code = (char-code char)
      do (cond
           ((char= char #\Space)
            (if escape-whitespace
@@ -93,6 +94,11 @@
                (write-char char stream)))
           ((gethash char *html-entites*)
            (princ (gethash char *html-entites*) stream))
+          ((or (> code 127) (< code 32))
+              (write-char #\& stream)
+              (write-char #\# stream)
+              (princ code stream)
+              (write-char #\; stream))
           (t (write-char char stream)))))

The first reason is that, when using utf-8, some non-ascii characters get
escaped and some not (not sure why, based on the code, but it appeared so). The
second is that, at least in Opera 9, combo boxes do not parse escaped chars and
they appear as if they were, e.g., cdata attributes.

Alex

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



More information about the bese-devel mailing list