From ea39a333373d1e6cdab519e0dfa9453343368bdd Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Wed, 25 Oct 2023 14:40:29 +0100 Subject: [PATCH] Document server.servlet.encoding.* configuration properties Closes gh-32472 --- .../src/docs/asciidoc/web/servlet.adoc | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/web/servlet.adoc b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/web/servlet.adoc index 4ce64dce56b..9fc8d6e0314 100644 --- a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/web/servlet.adoc +++ b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/web/servlet.adoc @@ -611,6 +611,27 @@ For example, adding the following bean will automatically apply a `SameSite` of include::code:MySameSiteConfiguration[] +[[web.servlet.embedded-container.customizing.encoding]] +===== Character Encoding +The character encoding behavior of the embedded servlet container for request and response handling can be configured using the `server.servlet.encoding.*` configuration properties. + +When a request's `Accept-Language` header indicates a locale for the request it will be automatically mapped to a charset by the servlet container. +Each containers providers default locale to charset mappings and you should verify that they meet your application's needs. +When they do not, use the configprop:server.servlet.encoding.mapping[] configuration property to customize the mappings, as shown in the following example: + +[source,yaml,indent=0,subs="verbatim",configprops,configblocks] +---- + server: + servlet: + encoding: + mapping: + ko: "UTF-8" +---- + +In the preceding example, the `ko` (Korean) locale has been mapped to `UTF-8`. +This is equivalent to a `` entry in a `web.xml` file of a traditional war deployment. + + [[web.servlet.embedded-container.customizing.programmatic]] ===== Programmatic Customization