Response Encoding returned by CreationContainerListRestlet is ISO-8859-15 
instead UTF-8
---------------------------------------------------------------------------------------

                 Key: NXP-4281
                 URL: http://jira.nuxeo.org/browse/NXP-4281
             Project: Nuxeo Enterprise Platform
          Issue Type: Bug
    Affects Versions: 5.1.6
         Environment: Restlet v1.0.7
            Reporter: Benjamin Jalon
            Assignee: Thierry Delprat


This code not set the response encoding :
res.setEntity(resultDocument.asXML(), MediaType.TEXT_XML);

by default this setEntity generate a StringRepresentation with charSet set to 
Null.
And for americans, it's logic to create StringRepresentation like that :

    public StringRepresentation(CharSequence text, MediaType mediaType,
            Language language) {
        this(text, mediaType, language, CharacterSet.ISO_8859_1);
    }



In com.noelios.restlet.http.HttpServerConverter.addResponseHeaders implements 
that :
                if (entity.getMediaType() != null) {
                    StringBuilder contentType = new StringBuilder(entity
                            .getMediaType().getName());

                    if (entity.getCharacterSet() != null) {
                        // Specify the character set parameter
                        contentType.append("; charset=").append(
                                entity.getCharacterSet().getName());
                    }

                    responseHeaders.add(HttpConstants.HEADER_CONTENT_TYPE,
                            contentType.toString());
                }

So we need to create explicitly StringRepresentation and add characterSet in 
the representation (che) :

        Representation rep = new StringRepresentation(resultDocument.asXML(), 
MediaType.TEXT_XML);
        rep.setCharacterSet(CharacterSet.UTF_8);
        res.setEntity(rep);



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.nuxeo.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        
_______________________________________________
ECM-tickets mailing list
[email protected]
http://lists.nuxeo.com/mailman/listinfo/ecm-tickets

Reply via email to