Add Tomcat locale mapping for Japanese to preserve UTF-8 charset

See gh-30535
pull/30692/head
Chris Hut 3 years ago committed by Moritz Halbritter
parent b5a02d9a66
commit 65d8c76ac3

@ -260,6 +260,7 @@ public class TomcatServletWebServerFactory extends AbstractServletWebServerFacto
private void resetDefaultLocaleMapping(TomcatEmbeddedContext context) { private void resetDefaultLocaleMapping(TomcatEmbeddedContext context) {
context.addLocaleEncodingMappingParameter(Locale.ENGLISH.toString(), DEFAULT_CHARSET.displayName()); context.addLocaleEncodingMappingParameter(Locale.ENGLISH.toString(), DEFAULT_CHARSET.displayName());
context.addLocaleEncodingMappingParameter(Locale.FRENCH.toString(), DEFAULT_CHARSET.displayName()); context.addLocaleEncodingMappingParameter(Locale.FRENCH.toString(), DEFAULT_CHARSET.displayName());
context.addLocaleEncodingMappingParameter(Locale.JAPANESE.toString(), DEFAULT_CHARSET.displayName());
} }
private void addLocaleMappings(TomcatEmbeddedContext context) { private void addLocaleMappings(TomcatEmbeddedContext context) {

@ -411,6 +411,7 @@ class TomcatServletWebServerFactoryTests extends AbstractServletWebServerFactory
// override defaults, see org.apache.catalina.util.CharsetMapperDefault.properties // override defaults, see org.apache.catalina.util.CharsetMapperDefault.properties
assertThat(getCharset(Locale.ENGLISH)).isEqualTo(StandardCharsets.UTF_8); assertThat(getCharset(Locale.ENGLISH)).isEqualTo(StandardCharsets.UTF_8);
assertThat(getCharset(Locale.FRENCH)).isEqualTo(StandardCharsets.UTF_8); assertThat(getCharset(Locale.FRENCH)).isEqualTo(StandardCharsets.UTF_8);
assertThat(getCharset(Locale.JAPANESE)).isEqualTo(StandardCharsets.UTF_8);
} }
@Test @Test

Loading…
Cancel
Save