Expand my Community achievements bar.

SOLVED

Sling model exporter with a different character encoding in the response

Avatar

Level 2

Hello everyone,

Does someone know how can I change the character encoding in the response on a sling model exporter?

Here a piece of code that I'm using

@Model(adaptables = SlingHttpServletRequest.class,
   resourceType = {"..."},
   defaultInjectionStrategy = DefaultInjectionStrategy.OPTIONAL
)

@Exporter(name = "jackson", selector = "des", extensions = "json", options = {@ExporterOption(name = "SerializationFeature.WRITE_DATES_AS_TIMESTAMPS", value = "true")})

In the client I'm getting:

Content-Type:

application/json; charset=ISO-8859-1

But I'd like to use "UTF-8" instead of ISO-8859-1

1 Accepted Solution

Avatar

Correct answer by
Level 2

Thank you for you response. It is a bug and is reported here [SLING-7344] Jackson Sling Model Exporter needs correct character encoding - ASF JIRA .  The solution is upgrade the version of the bundle Models Implementation which you can download here Apache Sling :: Downloads

View solution in original post

2 Replies

Avatar

Correct answer by
Level 2

Thank you for you response. It is a bug and is reported here [SLING-7344] Jackson Sling Model Exporter needs correct character encoding - ASF JIRA .  The solution is upgrade the version of the bundle Models Implementation which you can download here Apache Sling :: Downloads