0

I have implemented a basic spring mvc form. Now, it is able to read special characters like @#$%^&* but there are few things which is missing like, if I type "..........", it reads it as something like "?.." or it is not reading text between < and > characters. I googled out to find out the solution and so it seems that spring mvc by default do not follow UTF-8 pattern. So, I appended the following code in web.xml

           <filter>
   <filter-name>springCharacterEncodingFilter</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>

I am using

      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

in my page. Also, in my server.xml I am using

    <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" URIEncoding="UTF-8"/>

But the problem is still there. Can anyone suggest me what I am missing out or there is any other cause of the problem?

0

1 Answer 1

2

I got the solution finally...You need to use

    <%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="ISO-8859-1"%>

Instead of

   <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>

In your jsp files.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.