You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Jon Smirl <jo...@mediaone.net> on 2000/09/10 21:40:10 UTC

Xalan-C: output encoding

Shouldn't Xalan-C be writing to a binary output stream instead of a
character based one? The output charset is controlled by the encoding
parameter on <xsl:output>. Xalan should do the transcoding before calling
the output stream write function.

For example it doesn't look like I can force Xalan-C to output a Shift-JIS
encoded stream. Xalan is adding the charset="" tag on HTML output, but the
output is not in the charset specified.

This call converts to the local charset, my local charset is windows-1252
not Shift-JIS.

void
XercesTextOutputStream::doWrite(const XalanDOMChar*  theBuffer)
{
 assert(theBuffer != 0);

    const XalanArrayAutoPtr<char>
theTranscodedString(XMLString::transcode(theBuffer));

 writeData(theTranscodedString.get(),
     strlen(theTranscodedString.get()));
}

I may be confused on what Xalan is doing but here's what I thought I would
find:
1) internal class TextOutputStream, only supports wchar writes since Xalan
is pure wchar internally
2) externally overridable BinaryOutputStream, only supports BYTE writes.
3) TextOutputStream receives an encoding from the stylesheet, if none
defaults to local code page.
4) This encoding info is used to transcode writes to TextOutputStream into
binary writes to the overridable BinaryOutputStream.

Jon Smirl
jonsmirl@mediaone.net