xmlHelper cannot save multi-byte character correctly
-----------------------------------------------------
Key: TUSCANY-3498
URL: https://issues.apache.org/jira/browse/TUSCANY-3498
Project: Tuscany
Issue Type: Bug
Components: Java SDO Implementation
Affects Versions: Java-SDO-1.1
Environment: doesn't matter
Reporter: xuhongbo
xmlHelper provide some save method which could save dataobject to string or
save XmlDocument to Writer. while using these method to save xml, TuscanySDO
always assume the system's default encoding is same as XMLDocument 's encoding.
If they are not same, the saved xml will contains invalid chracter for
multi-byte character(etc chinese).
To correct this bug is very simple. just change the
org.apache.tuscany.sdo.helper.XMLDocumentImpl 's save method:
protected void save(Writer outputWriter, Object options) throws IOException
{
// TODO temporary brute-force implementation ... to be replaced
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
save(outputStream, options);
<<<<<<<<<<<<<<<<
// outputWriter.write(new String(outputStream.toByteArray());
>>>>>>>>>>
outputWriter.write(new String(outputStream.toByteArray(),
this.getEncoding());
}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.