[html-template-devel] problem with UTF characters in template

Edi Weitz edi at agharta.de
Fri May 18 15:58:16 UTC 2007


On Fri, 18 May 2007 11:24:15 -0400, Dimitre Liotev <dl at znain.net> wrote:

> I am using the "Simple example" from your page
> http://weitz.de/html-template/, specifying :external-format "UTF-8"
> in the call to create-template-printer:

Is the string "UTF-8" a valid external format specifier on AllegroCL?

> (defparameter *template-dispatcher*
>   (hunchentoot:create-prefix-dispatcher "/template-test/"
>    (lambda ()
>      (let* ((html-template:*string-modifier* #'identity)
>            (rows (loop for i below 49 by 7
>                    collect
>                      (list :cols
>                            (loop for j from i below (+ i 7)
>                               for string = (format nil "~R" j)
>                               collect (list :content string 
>                                             :colorful-style (oddp j))))))
>           (values (list :rows rows)))
>        (with-output-to-string (html-template:*default-template-output*)
>          (html-template:fill-and-print-template
>           (html-template:create-template-printer #p"foo.tmpl" :external-format "UTF-8")
>           values))))))
>
> [...]
>
>  12: ((METHOD STREAM-WRITE-CHAR
>        (FLEXI-STREAMS::FLEXI-LATIN-1-OUTPUT-STREAM T))
>       #<FLEXI-STREAMS::FLEXI-LATIN-1-OUTPUT-STREAM @ #x21279e5a> #\?)
>       Locals:
>         STREAM = #<FLEXI-STREAMS::FLEXI-LATIN-1-OUTPUT-STREAM @
>   #x21279e5a>
>         CHAR = #\?
>         CHAR = #\?
>         FLEXI-STREAMS:OCTET = 1044
>         STREAM = #<FLEXI-STREAMS::FLEXI-LATIN-1-OUTPUT-STREAM @
>   #x21279e5a>

The condition is signalled when Hunchentoot is trying to write the
page to the client.  You have to make sure that Hunchentoot knows that
it's supposed to output UTF-8.  See the examples that come with
Hunchentoot for how this can be done.  (And you should also set the
headers accordingly, so the browser knows what to expect.)



More information about the Html-template-devel mailing list