[tbnl-devel] Re: Web programming question

Edi Weitz edi at agharta.de
Wed Jul 5 13:59:46 UTC 2006


On 05 Jul 2006 12:28:10 +0900, Dan Beauchesne <dbeauchesne at gmail.com> wrote:

> Also, in regards to the UTF-8 + SBCL + content-length problem, I'm
> curious if Dr. Weitz's Lisp (Allegro?) does not have this problem?
> I've been looking for a good excuse to grab the student edition,
> maybe this is it :)

I'm not using AllegroCL, I use LispWorks.  The problem is actually
always the same - the HTTP standard demands that the content length
header counts the number of octets, but in Common Lisp, LENGTH applied
to a string counts the number of characters which is not the same for
UTF-8.

The test/ directory of TBNL contains two example pages that deliver
UTF-8 content.  One is LW-only but it should be easy to convert it to
SBCL using SBCL's internal STRING-TO-OCTETS function (see util.lisp),
the other one uses TBNL:SEND-HEADERS and thus avoids to send a content
length header at all.  If your front-end is able to do that (like
Apache/mod_lisp or Hunchentoot), then this should result in chunked
encoding.

HTH,
Edi.



More information about the Tbnl-devel mailing list