I have a simple form submit request. Before the request is receiving to Servlet it is going through the Filter. In that Filter I am setting charset encoding as "iso-8859-15", because of this charset encoding the request parameter value is not encoding properly.
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse,
FilterChain chain) throws IOException {
servletRequest.setCharacterEncoding("iso-8859-15");
For example, I have parameter value as “1Depósito” and is encoding wrongly to “1Depósito” instead of “1Depósito”. Because I have some international language special character (i.e. "ó") in my request parameter value.
As per my google research, the input request encoding is UTF-8 but in filter we are setting different encoding i.e. iso-8859-15 hence it might be not encoding properly. But this issue we can see only when running in WebLogic 10. The same code is running fine when it run in spring-boot embedded Tomcat
NOTE:
- If i set the character Encoding as UTF-8 in my filter it is working fine even in WebLogic also but like to know how "iso-8859-15" encoding is working in Tomcat but not in Weblogic?
In both WebLogic & Tomcat the input request content type is same as shown below:
- Content-Type: application/x-www-form-urlencoded; charset=UTF-8
Then why the setCharacterEncoding is failing only in WebLogic not in Tomcat?
Do we have any default encoding settings for spring-boot embedded Tomcat server?
How could I fix this issue in my WebLogic deployment?
Looking forward to your valuable inputs.
Thanks, BSK
CharacterEncodingFilter
is UTF-8 . – M. Deinumweb.xml
so it uses the default configurationCharacterEncodingFilter
and not your own filter. Also when using aweb.xml
with Spring Boot make sure you are using Spring Boot Legacy to properly bootstrap it. Or ditch it and use the proper way to bootstrap it as documented here. – M. Deinum