Reputation: 579
When I post non english characters from my HTML Form, on server side I recieve some UTF-8 character, but not the original UTF-8 character. For example, in Kannada 'ಇಲಾಖೆಯ' becomes 'ಇಲಾಖೆಯ', or in french, 'département' becomes 'département'.
My HTML Form has attribute accept-charset
as UTF-8
, I have meta content type
to text/html; charset=UTF-8
. My JBoss server is also configured for UTF-8
.
I have compiled source code as UTF-8 in Maven.
I have added CharactersetEncoderFilter in web.xml as -
<filter>
<filter-name>encoding-filter</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>
<init-param>
<param-name>forceEncoding</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>encoding-filter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
Is there anyway to get back the original text that was posted from the HTML Form ?
Upvotes: 0
Views: 507
Reputation: 48236
Make sure your JSPs have pageEncoding=UTF-8. In web.xml:
<jsp-config>
<jsp-property-group>
<url-pattern>*.jsp</url-pattern>
<page-encoding>UTF-8</page-encoding>
</jsp-property-group>
</jsp-config>
Is your browser Internet Exploder?
Is the input actually UTF-8 or is it copy-pasted from MS Word?
Upvotes: 1