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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]