[Openmcl-devel] encoding/decoding clozure strings to/from UTF-8
    Karsten Poeck 
    Karsten.Poeck at gmail.com
       
    Tue Dec 30 14:30:43 PST 2014
    
    
  
>
> I'm trying to do this in with the cl-http web server, so my own code doesn't create the stream, that's done in the background somewhere by cl-http. Anyone know how to make it work in that context?
>
Regarding cl-http, which port are you using?
I did some adaptions to cl-http so that I runs under ccl, Rainer Joswig 
has an optimized version.
My version is in trunk/contrib/kpoeck/port-template
Stream creation is done in my port in the following method, I already 
added utf-8 there
(defun %wait-for-connection (socket)
   (let ((stream (ccl:accept-connection socket :wait t :stream-args 
'(:external-format :utf-8))))
     stream))
I thought than it might be as easy as:
(in-package :http)
(defmethod test-utf-8 ((url t) stream)
   (http:with-successful-response (stream :html :expires 
(url:expiration-universal-time url))
     (let ((title "Test-UTF-8"))
       (with-html-document (:stream stream)
         (with-document-preamble (:stream stream)
           (declare-title title :stream stream)
           (with-document-body (:stream stream)
             (write-string "$¢€" stream)))))))
  (http:export-url #u"/test-utf-8.html"
                    :html-computed
                    :expiration `(:interval 0)
                    :response-function #'test-utf-8
                    )
but it seems that somewhere the header content-type is specified as
Content-Type	text/html; charset=ISO-8859-1
Will have to digg into this.
regards
Karsten
    
    
More information about the Openmcl-devel
mailing list