[Openmcl-devel] encoding/decoding clozure strings to/from UTF-8
Mark Klein
m_klein at mit.edu
Tue Dec 30 14:57:11 PST 2014
> oops, that was easy.
> The following seems to work
>
> (defmethod test-utf-8 ((url t) stream)
> (http:with-successful-response (stream :html :character-set :utf-8 :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)))))))
>
> and the header is:
> Content-Type: text/html; charset=UTF-8
I tried the following:
(defmethod test ((url url:http-computed-url) stream)
(http:with-successful-response (stream :html :character-set :utf-8 :expires (url:expiration-universal-time url))
(let ((title "Test-UTF-8"))
(html:with-html-document (:stream stream)
(html:with-document-preamble (:stream stream)
(html:declare-title title :stream stream)
(html:with-document-body (:stream stream)
(write-string "foo $¢€ Ласкаво просимо до" stream)))))))
(http:export-url #u"/test"
:computed
:response-function #'test)
and it didn't work, only the following characters came through:
foo $�
I wonder why we got different results?
> Regarding cl-http, which port are you using?
cl-http 70.220
Mark
-------------------------------
Mark Klein
http://cci.mit.edu/klein
Principal Research Scientist
Center for Collective Intelligence
Massachusetts Institute of Technology
Visiting Researcher
Dynamic and Distributed Information Systems Group
University of Zurich
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 1842 bytes
Desc: not available
URL: <https://lists.clozure.com/pipermail/openmcl-devel/attachments/20141230/70fc6982/attachment.bin>
More information about the Openmcl-devel
mailing list