[
https://jira.nuxeo.org/browse/NXP-4281?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=73961#action_73961
]
Douglas SIX commented on NXP-4281:
----------------------------------
Hi,
This issue may not be resolved for the Browse Restlet.
In the file:
nuxeo-platform-ui-web/src/main/java/org/nuxeo/ecm/platform/ui/web/restAPI/BrowseRestlet.java
In the function:
protected void doHandleStatelessRequest (Request req, Response res)
There is a "return" just after the line (ligne 70):
res.setEntity(result.asXML(), MediaType.TEXT_XML);
I think it needs the :
Representation rep = new StringRepresentation(resultDocument.asXML(),
MediaType.TEXT_XML);
rep.setCharacterSet(CharacterSet.UTF_8);
res.setEntity(rep);
Just before the "return".
Thanks,
Douglas.
> Response Encoding returned by CreationContainerListRestlet is ISO-8859-15
> instead UTF-8
> ---------------------------------------------------------------------------------------
>
> Key: NXP-4281
> URL: https://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: Benjamin Jalon
> Fix For: 5.1.6, 5.1.7, 5.3.1
>
>
> 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:
https://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