Skip to content Skip to sidebar Skip to footer

Form Character Encoding Problems With Special Characters

Hello I have a jsp with an html form. I set the content type like this: <%@ page language='java' contentType='text/html; charset=ISO-8859-1' pageEncoding='ISO-8859-1' %> Whe

Solution 1:

When your pages are not ISO-8859-1, you need to declare a CharacterEncodingFilter in web.xml:

<filter>
    <filter-name>charsetFilter</filter-name>
    <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
    <init-param>
        <param-name>encoding</param-name>
        <param-value>UTF-8</param-value>
    </init-param>
</filter>

<filter-mapping>
    <filter-name>charsetFilter</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>

Post a Comment for "Form Character Encoding Problems With Special Characters"