[hunchentoot-devel] Re: utf-8 encoding problems

Andrei Stebakov lispercat at gmail.com
Tue Sep 2 20:32:09 UTC 2008


No luck emailing the quotation marks. Let's try a German character 'ß'

(defun test-handler ()
  (no-cache)
  (recompute-request-parameters :external-format (flex:make-external-format
:utf-8 :eol-style :lf))
  (setf (hunchentoot:content-type) "text/html; charset=utf-8")
  (with-html-output-to-string (*standard-output* nil :prologue nil :indent
nil)
    (:html
     (:head
      (:title "Test page"))
     (:body
      (:p "weiß")))))

Will produce text like "wei�"
If I set the global variable:
(setf *hunchentoot-default-external-format* (flex:make-external-format
:utf-8 :eol-style :lf))
the problem gets fixed.

Andrew


On Tue, Sep 2, 2008 at 2:03 PM, Andrei Stebakov <lispercat at gmail.com> wrote:

> I have problems with some of the utf-8 characters in sbcl 1.0.18 and
> hunchentoot-0.15.7 (Ubuntu)
> When I create a handler like this:
>
> (defun test-handler ()
>   (no-cache)
>   (recompute-request-parameters :external-format (flex:make-external-format
> :utf-8 :eol-style :lf))
>   (setf (hunchentoot:content-type) "text/html; charset=utf-8")
>   (with-html-output-to-string (*standard-output* nil :prologue nil :indent
> nil)
>     (:html
>      (:head
>       (:title "Test page"))
>      (:body
>       (:p
>
> ""quotation"")))))
>
>
> Where I have those "right and left quotation marks" I get an error:
> #\LEFT_DOUBLE_QUOTATION_MARK (code 8220) is not a LATIN-1 character.
>    [Condition of type FLEXI-STREAMS:EXTERNAL-FORMAT-ENCODING-ERROR]
>
> If, on the other hand, I set global variable
> *hunchentoot-default-external-format* to utf-8
> (setf *hunchentoot-default-external-format* (flex:make-external-format
> :utf-8 :eol-style :lf))
> then everything works.
> I just want one handler to handle the uft-8 encoding, how can I fix it?
>
> Thank you,
> Andrew
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/tbnl-devel/attachments/20080902/06701c75/attachment.html>


More information about the Tbnl-devel mailing list