Skip to content

Form parameters should be in UTF-8 encoding [SPR-11779] #16401

Closed
@spring-projects-issues

Description

@spring-projects-issues

Adam Berlin opened SPR-11779 and commented

Our application needs to receive UTF-8 from forms, but out of the box our high byte characters were getting mutilated.

Digging through the stack, we found that by default our RequestMappingHandlerAdapter has a coyoteRequest (a couple layers down within other request wrappers) with tomcat http parameters with an encoding attribute of "ISO-8859-1".

We were able to solve this in our application by manually setting the encoding to UTF-8:

@Configuration
public class FilterConfig {
    @Bean
    public Filter encodingFilter() {
        CharacterEncodingFilter encodingFilter = new CharacterEncodingFilter();
        encodingFilter.setEncoding("UTF-8");
        return encodingFilter;
    }
}

We'd love it if the default encoding, instead of ISO-8859-1, were the more ubiquitous UTF-8.

Thanks,
taavo ([email protected]) & tim ([email protected])


Issue Links:

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)status: declinedA suggestion or change that we don't feel we should currently applytype: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions