Per the _javascript_ RFC, the `text/_javascript_` mime-type has an optional `charset` parameter.
Essentially, if the charset is unspecified, then the encoding is UTF-8.
> the encoding is unfortunately not set to utf8 (like it is for the served json files).
For JSON, the charset parameter is not used.
Per spec, JSON is always UTF-8.
In Jetty, the json encoding is specified as an assumed UTF-8.
This means the `charset` parameter is not produced when generating the `Content-Type` header, and is ignored when parsing the `Content-Type` header.
> Is there a way to enforce that without compiling a custom version of Jetty?
You can customize the in-place `MimeTypes` for a context.
Examples:
servletContextHandler.getMimeTypes().addMimeMapping("txt", "text/_javascript_;charset=UTF-8");
or
webappContext.getMimeTypes().addMimeMapping("txt", "text/_javascript_;charset=UTF-8");
or, If you have a WEB-INF/web.xml in your webapp, you can add a `<mime-mapping>` entry.
<mime-mapping>
<extension>js</extension>
<mime-type>text/_javascript_;charset=UTF-8</mime-type>
</mime-mapping>