[cl-wiki-devel] Encoding question and a patch

Ian Clelland clelland at gmail.com
Tue Sep 6 04:17:31 UTC 2005


On 9/5/05, Ian Clelland <clelland at gmail.com> wrote:
> On 9/4/05, Vehbi Sinan Tunalioglu <vehbisinan at gmail.com> wrote:
> > Thanks Ian...
> >
> > I could not find the #'esc documentation either... I'm trying to fix it,
> > too.
> 
> I looked into it a bit more yesterday, there is no "esc" function per
> se; rather cl-who interprets a form like (esc "some string") as if it
> were an actual function call to (escape-char "some string")
> 
> It's the cl-who:escape-char function which is giving us these
> problems. I'm looking at possible ways of shadowing that function with
> our own version, or possibly just bypassing it and writing a utf-8
> decoding function for cl-wiki.


After a lot of hassle dealing with cl-who, and after determining that
the sbcl that comes with Debian Sarge does not, in fact, support
unicode, and after thinking a lot about where to position a custom
UTF-8 decoder, I have realised that the best solution to this problem
is to simply not use the form (esc content). Instead, we can use (str
(escape-for-html content)), and use exactly the same formatting rules
in the editting textarea as we do for the standard page output.

------------------------------------------------------------
Quick patch file:

--- /home/ian/cl-wiki-0.0.3/wiki.lisp   2005-09-05 21:07:10.000000000 -0700
+++ wiki.lisp   2005-09-05 21:05:14.000000000 -0700
@@ -127,7 +127,7 @@
                          (:legend "Edit page")
                          (:input :type "hidden" :name "action" :value "save")
                          (:p
-                          (:textarea :name "content" :rows "15" :cols
"60" (esc content)))
+                          (:textarea :name "content" :rows "15" :cols
"60" (str (escape-for-html content))))
                          (:input :type "submit" :value "Save"))))))
     (execute-main-template page body :edit t)))



------------------------------------------------------------

I've tried this on our running site, and it loads and saves unicode
documents with no problems.

Let me know if this works for you.

Regards,
Ian Clelland
<clelland at gmail.com>



More information about the Cl-wiki-devel mailing list