[ 
https://issues.apache.org/jira/browse/CMIS-377?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13036836#comment-13036836
 ] 

Cedric Moitrier commented on CMIS-377:
--------------------------------------

Unfortunatly, not all implementations of XMLOutputFactory defaults to UTF-8.

If no encoding is specified when creating an XMLOutputStream from an 
OutputStream, sjsxp (Sun's implementation) will use the value of the 
"file.encoding" system property. As no encoding is set in the XML response 
header, the XML parser from the client side will not be able to handle the 
document properly.

All is working fine if woodstox is used instead of sjsxp.


> Characters encoding issue when using Atom binding
> -------------------------------------------------
>
>                 Key: CMIS-377
>                 URL: https://issues.apache.org/jira/browse/CMIS-377
>             Project: Chemistry
>          Issue Type: Bug
>          Components: opencmis-server
>    Affects Versions: OpenCMIS 0.3.0
>            Reporter: Cedric Moitrier
>
> Atom binding does not properly handle characters encoding in HTTP responses.
> Actually, the XMLOutputStream is created using the following piece of code:
> <pre>
> XMLOutputFactory factory = XMLOutputFactory.newInstance();
> fWriter = factory.createXMLStreamWriter(out);
> fWriter.writeStartDocument();
> </pre>
> which is located in 
> org.apache.chemistry.opencmis.server.impl.atompub.XMLDocumentBase#startDocument(OutputStream).
> In order for the encoding in the XML header to match the actual characters 
> encoding, this should be replaced by:
> <pre>
> XMLOutputFactory factory = XMLOutputFactory.newInstance();
> fWriter = factory.createXMLStreamWriter(out, encoding);
> fWriter.writeStartDocument(encoding, "1.0");
> </pre>
> The output encoding can be obtain from the HTTP request.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to