You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "Adam Lally (JIRA)" <xa...@xml.apache.org> on 2005/05/31 22:41:51 UTC

[jira] Created: (XALANJ-2132) Incorrect serialization of supplementary Unicode characters

Incorrect serialization of supplementary Unicode characters
-----------------------------------------------------------

         Key: XALANJ-2132
         URL: http://issues.apache.org/jira/browse/XALANJ-2132
     Project: XalanJ2
        Type: Bug
    Versions: 2.6    
 Environment: Windows XP, Sun JRE 1.5.0_03
    Reporter: Adam Lally
 Attachments: XsltSerializeSurrogates.java

Passing a surrogate pair to a TransformerHandler causes incorrect UTF-8 to be generated.  The following code illustrates the problem:


    SAXTransformerFactory transformerFactory = (SAXTransformerFactory)SAXTransformerFactory.newInstance();
    TransformerHandler handler = transformerFactory.newTransformerHandler();
    handler.setResult(new StreamResult(System.out));
    
    char[] chars = new char[2];
    chars[0] = (char)0xD803;
    chars[1] = (char)0xDD75;

    handler.startDocument();
    handler.startElement("","","foo", new AttributesImpl());
    handler.characters(chars, 0, chars.length);
    handler.endElement("","","foo");
    handler.endDocument();


If you take the output of this program and try to parse it with the Xerces SAX Parser, you get an "Invalid byte 2 of 3-byte UTF-8 sequence" exception.







-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org


[jira] Updated: (XALANJ-2132) Incorrect serialization of supplementary Unicode characters

Posted by "Adam Lally (JIRA)" <xa...@xml.apache.org>.
     [ http://issues.apache.org/jira/browse/XALANJ-2132?page=all ]

Adam Lally updated XALANJ-2132:
-------------------------------

    Attachment: XsltSerializeSurrogates.java

Test case that generates invalid UTF-8

> Incorrect serialization of supplementary Unicode characters
> -----------------------------------------------------------
>
>          Key: XALANJ-2132
>          URL: http://issues.apache.org/jira/browse/XALANJ-2132
>      Project: XalanJ2
>         Type: Bug
>     Versions: 2.6
>  Environment: Windows XP, Sun JRE 1.5.0_03
>     Reporter: Adam Lally
>  Attachments: XsltSerializeSurrogates.java
>
> Passing a surrogate pair to a TransformerHandler causes incorrect UTF-8 to be generated.  The following code illustrates the problem:
>     SAXTransformerFactory transformerFactory = (SAXTransformerFactory)SAXTransformerFactory.newInstance();
>     TransformerHandler handler = transformerFactory.newTransformerHandler();
>     handler.setResult(new StreamResult(System.out));
>     
>     char[] chars = new char[2];
>     chars[0] = (char)0xD803;
>     chars[1] = (char)0xDD75;
>     handler.startDocument();
>     handler.startElement("","","foo", new AttributesImpl());
>     handler.characters(chars, 0, chars.length);
>     handler.endElement("","","foo");
>     handler.endDocument();
> If you take the output of this program and try to parse it with the Xerces SAX Parser, you get an "Invalid byte 2 of 3-byte UTF-8 sequence" exception.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org


[jira] Updated: (XALANJ-2132) Incorrect serialization of supplementary Unicode characters

Posted by "Brian Minchau (JIRA)" <xa...@xml.apache.org>.
     [ http://issues.apache.org/jira/browse/XALANJ-2132?page=all ]

Brian Minchau updated XALANJ-2132:
----------------------------------

    Fix Version: 2.7

> Incorrect serialization of supplementary Unicode characters
> -----------------------------------------------------------
>
>          Key: XALANJ-2132
>          URL: http://issues.apache.org/jira/browse/XALANJ-2132
>      Project: XalanJ2
>         Type: Bug
>     Versions: 2.6
>  Environment: Windows XP, Sun JRE 1.5.0_03
>     Reporter: Adam Lally
>      Fix For: 2.7
>  Attachments: XsltSerializeSurrogates.java
>
> Passing a surrogate pair to a TransformerHandler causes incorrect UTF-8 to be generated.  The following code illustrates the problem:
>     SAXTransformerFactory transformerFactory = (SAXTransformerFactory)SAXTransformerFactory.newInstance();
>     TransformerHandler handler = transformerFactory.newTransformerHandler();
>     handler.setResult(new StreamResult(System.out));
>     
>     char[] chars = new char[2];
>     chars[0] = (char)0xD803;
>     chars[1] = (char)0xDD75;
>     handler.startDocument();
>     handler.startElement("","","foo", new AttributesImpl());
>     handler.characters(chars, 0, chars.length);
>     handler.endElement("","","foo");
>     handler.endDocument();
> If you take the output of this program and try to parse it with the Xerces SAX Parser, you get an "Invalid byte 2 of 3-byte UTF-8 sequence" exception.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org


[jira] Resolved: (XALANJ-2132) Incorrect serialization of supplementary Unicode characters

Posted by "Brian Minchau (JIRA)" <xa...@xml.apache.org>.
     [ http://issues.apache.org/jira/browse/XALANJ-2132?page=all ]
     
Brian Minchau resolved XALANJ-2132:
-----------------------------------

    Resolution: Duplicate

Adam,
I'm resolving this as a duplicate of XALANJ-2087.
I've verified that the patch that I put in that issue fixes your problem. However, you are the defect orginator, so it would be best you you verified that too.  Thanks.

> Incorrect serialization of supplementary Unicode characters
> -----------------------------------------------------------
>
>          Key: XALANJ-2132
>          URL: http://issues.apache.org/jira/browse/XALANJ-2132
>      Project: XalanJ2
>         Type: Bug
>     Versions: 2.6
>  Environment: Windows XP, Sun JRE 1.5.0_03
>     Reporter: Adam Lally
>  Attachments: XsltSerializeSurrogates.java
>
> Passing a surrogate pair to a TransformerHandler causes incorrect UTF-8 to be generated.  The following code illustrates the problem:
>     SAXTransformerFactory transformerFactory = (SAXTransformerFactory)SAXTransformerFactory.newInstance();
>     TransformerHandler handler = transformerFactory.newTransformerHandler();
>     handler.setResult(new StreamResult(System.out));
>     
>     char[] chars = new char[2];
>     chars[0] = (char)0xD803;
>     chars[1] = (char)0xDD75;
>     handler.startDocument();
>     handler.startElement("","","foo", new AttributesImpl());
>     handler.characters(chars, 0, chars.length);
>     handler.endElement("","","foo");
>     handler.endDocument();
> If you take the output of this program and try to parse it with the Xerces SAX Parser, you get an "Invalid byte 2 of 3-byte UTF-8 sequence" exception.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org