Details
-
Bug
-
Status: Closed
-
Resolution: Won't Fix
-
unspecified
-
None
-
None
-
Operating System: All
Platform: PC
Description
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.