[Lispweb] Stream encoding question

Jonathon McKitrick jcm at FreeBSD-uk.eu.org
Sat Sep 30 11:26:30 CDT 2006


Is there a way to set the encoding for the stream used to serve files in
araneida?  I *think* that's what I'm asking, but I'm not sure.

I have an html file with a few non-latin-1 characters - copyright, TM, a
bullet, etc.  Serving them as static files works fine, but when I use
html-template to serve the file, it signals a condition:

encoding error on stream #<SB-SYS:FD-STREAM for "a constant string"
{128ACFB1}>
(:EXTERNAL-FORMAT :LATIN-1):
 the character with code 8226 cannot be encoded.
   [Condition of type SB-INT:STREAM-ENCODING-ERROR]

   Restarts:
    0: [OUTPUT-NOTHING] Skip output of this character.
	 1: [ABORT-RESPONSE] Abort this response and answer another request
	  2: [ABORT] Exit debugger, returning to top level.

	  Backtrace:
	   0: (SB-INT:STREAM-ENCODING-ERROR #<SB-SYS:FD-STREAM for "a constant
	   string" {128ACFB1}> 8226)
	    1: (SB-IMPL::STREAM-ENCODING-ERROR-AND-HANDLE #<SB-SYS:FD-STREAM for
		"a constant string" {128ACFB1}> 8226)
		 2: (SB-IMPL::OUTPUT-BYTES/LATIN-1 #<SB-SYS:FD-STREAM for "a constant
		 string" {128ACFB1}> "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML
		 4.01//EN\"
		 \"http://www.w3.org/TR/html4/strict.dtd\">

		 --- html snipped ---

		 <div class=\"comment\">
		  Copyright (c) 2006 Reed Larkey Group Inc. &nbsp; ? &nbsp; Website
		  designed by
		   <a href=\"http://www.bartosz.co.nr/\">Bartosz Brzezinski</a>
		   </div>

		   </div><!-- container -->
		   </body>

		   </html>
		   " #<SB-SYS:FD-STREAM for "a constant string" {128ACFB1}> :START 0
		   :END NIL)
		    6: ((LAMBDA (VALUES)) NIL)
			 7: ((SB-PCL::FAST-METHOD HTML-TEMPLATE:FILL-AND-PRINT-TEMPLATE
			 (PATHNAME T)) #<unavailable argument> #<unavailable argument>
			 #P"web/am01/index.html" NIL (:STREAM #<SB-SYS:FD-STREAM for "a
			 constant string" {128ACFB1}>))


Changing EXTERNAL-FORMAT for HTML-TEMPLATE doesn't change anything.  It still
shows up as LATIN-1 when served through araneida.  Calling HTML-TEMPLATE alone
in SLIME sends the file in question to the output buffer with no problem.

You can see it is the same stream being used by html-template and araneida,
but araneida does not handle the non-latin-1 characters in this instance,
though it can serve the file directly w/o a template with no problem.

Jonathon McKitrick
--
My other computer is your Windows box.



More information about the lispweb mailing list