You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xmlbeans-dev@xml.apache.org by bu...@apache.org on 2004/01/15 02:18:24 UTC

DO NOT REPLY [Bug 26146] New: - XmlTokenSource.save() does not use specified character encoding

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=26146>.
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=26146

XmlTokenSource.save() does not use specified character encoding

           Summary: XmlTokenSource.save() does not use specified character
                    encoding
           Product: XMLBeans
           Version: unspecified
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Binding
        AssignedTo: xmlbeans-dev@xml.apache.org
        ReportedBy: michael.gris@autodesk.com


Saving the in-memory XML via the .save(Writer w, XmlOptions options) method 
inherited from XmlTokenSource does not honour the specified character encoding.

Example:

{
    // ... code above

        // GENERATE THE RESPONSE OBJECT.
        XLSType responseXLS = processXLSDocument(requestXLS, 
globalRequestContext);

        // SERIALIZE THE RESPONSE OBJECT.
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        OutputStreamWriter osw = new OutputStreamWriter(bos, "ISO-8859-1");

        // Serialize the response.
        xlsDoc = XLSDocument.Factory.newInstance();
        xlsDoc.setXLS(responseXLS);

        opts = new XmlOptions();
        opts.setCharacterEncoding("ISO-8859-1");
        opts.setUseDefaultNamespace();
        opts.setSaveAggresiveNamespaces();

        xlsDoc.save(osw, opts);
        osw.flush();
        osw.close();

    // ... code below


Always produces a document that is encoded in UTF-8 (xml header <?xml 
version="1.0" encoding="UTF-8"?>).

Incidentally, I haven't been able to find the list of character encodings that 
is supported by XMLBeans.

- ---------------------------------------------------------------------
To unsubscribe, e-mail:   xmlbeans-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xmlbeans-dev-help@xml.apache.org
Apache XMLBeans Project -- URL: http://xml.apache.org/xmlbeans/