I'm mounting a directory which has translations inside of JavaScript. In order for the browser to render them properly, I need to pass a character encoding header.
The directory is mounted through Spring's resource handler like so:
public class WebMvcConfig extends WebMvcConfigurerAdapter implements ResourceLoaderAware {
@Override
public void addResourceHandlers(@Nonnull final ResourceHandlerRegistry registry) { registry.addResourceHandler("/app/static/scripts/**")
.addResourceLocations("/static/scripts/")
.setCachePeriod((int) TimeUnit.DAYS.toSeconds(365));
...
}
...
}
I haven't found an obvious way to set the default character encoding to UTF-8. Any ideas? I'm on Spring MVC 3.2.4.