[cxml-devel] ystream-unicode-p errors when serializing to character-stream
Nathan Bird
nathan at acceleration.net
Fri May 9 22:42:23 UTC 2008
With git head I get an error with the following:
(with-output-to-string (stream)
(let ((doc (dom:create-document
'rune-dom:implementation
nil nil
(dom:create-document-type
'rune-dom:implementation
"html"
"-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"))))
(dom:map-document (chtml:make-character-stream-sink stream)
doc
:include-xmlns-attributes nil
:include-doctype :full-internal-subset
)))
The error as far as I've been able to track it down, is that the ystream
created has a encoding slot, that is never filled. Then
#'runes::ystream-unicode-p chokes when trying to inspect the encoding.
We solved the error by testing the target stream when the encoding slot
is null:
(defun ystream-unicode-p (ystream)
(let ((enc (ystream-encoding ystream)))
(if enc
(or (eq enc :utf-8)
(eq (babel-encodings:enc-name enc) :utf-16))
#+rune-is-character (eq 'character (stream-element-type
(ystream-target-stream ystream))))))
But I'm not sure that it is sound, and that function looks kind of
strange anyways: what if encoding was the symbol :utf-16 or a
babel-encoding object with the name :utf-8? It looks like the shift to
babel-encodings is still somewhat a work-in-progress, does this help?
We found this today when we switched from asdf-installed version to git
HEAD because there was a problem with & getting escaped that looks like
it is already fixed in git.
More information about the cxml-devel
mailing list