Hi Chris,
Are you sure that the charset is being added by Sling, i.e. are you
accessing Sling directly or via an Apache server?

The Export Servlet doesn't actually try to infer anything about the content
type header. It just sets it to request.getResponseContentType(). See
[1]. If you trace that back far enough, it ultimately comes from the
MimeTypeService which I don't believe would ever include a charset. In the
ITs this comes back as just application/json.

Regards,
Justin

[1]
https://github.com/apache/sling-org-apache-sling-models-impl/blob/master/src/main/java/org/apache/sling/models/impl/ExportServlet.java#L110
[2]
https://github.com/apache/sling-org-apache-sling-models-integration-tests/blob/master/src/test/java/org/apache/sling/models/testing/exporter/ExporterIT.java#L287

On Wed, Nov 29, 2017 at 6:45 PM Chris Millar <ch...@millr.org> wrote:

> I've constructed a Sling Model Exporter with very basic options [0], and it
> seems to be outputting:
>
> Content-Type: application/json; charset=ISO-8859-1
>
> This breaks the JSON RFC [1] as the default character encoding. It should
> be:
>
> Content-Type: application/json; charset=UTF-8
>
> I'm hoping there's a solution to this, or that I'm missing something
> obvious. Any help is greatly appreciated.
>
> [0] https://gist.github.com/auniverseaway/c8b7b9013b5ecdd9c790253d194d17b6
> [1] https://tools.ietf.org/html/rfc7159#section-8.1
>

Reply via email to