DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=25984>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=25984

Character encoding in comments

           Summary: Character encoding in comments
           Product: XalanJ2
           Version: 2.5Dx
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Major
          Priority: Other
         Component: org.apache.xml.serializer
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


The trasnsformer throws an exception when trying to write content to the comment
the is not an ASCII character.

The cause is 2 problems:
1. TransformerImpl.transformToString() does not pass encoding information to the
ToTextStream.
2. ToStream.m_maxCharacter does not consider the encoding at all.

So when a character greater than 127 is written to a comment, an exception is
thrown.

This is a MAJOR bug, since script blocks in HTML should be wrapped in comments,
and thus it is not possible to write non-ASCII characters to script!

Here is a small example to reproduce:

XML:
-----
<a>איתי</a>

XSLT:
-----
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
        <xsl:template match="a">
                <out>
                        <xsl:comment>
                                <xsl:value-of select="."/>
                        </xsl:comment>
                </out>
        </xsl:template>
</xsl:stylesheet>

Reply via email to