Uploaded image for project: 'Tuscany'
  1. Tuscany
  2. TUSCANY-3498

xmlHelper cannot save multi-byte character correctly

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • Java-SDO-1.1
    • Java-SDO-Next
    • None
    • doesn't matter
    • Patch Available

    Description

      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()); }

      Attachments

        1. XMLDocumentImpl.java
          19 kB
          ext2

        Activity

          People

            rfeng Zhaohui Feng
            ext2xhb ext2
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: