You need to define a farsi filter for this to work.
Your filter should be like this
public class CharsetFilter implements Filter{
/**
* Logging output for this plug in instance.
*/
//private Log myLog = LogFactory.getLog(Constants.PACKAGE);
public void init(FilterConfig config) throws ServletException
{
//myLog.info(this.getClass().getName() + ": Starting filter.");
}
public void destroy()
{
//myLog.info(this.getClass().getName() + ": Destroying filter.");
}
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
throws IOException, ServletException
{
request.setCharacterEncoding("UTF-8");
//myLog.info(this.getClass().getName() + ": Setting request to " +
// request.getCharacterEncoding());
chain.doFilter(request,response);
}
}
You also need to define your filter in web.xml such as this:
<filter>
<filter-name>FarsiFilter</filter-name>
<filter-class>com.project.filter.CharsetFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>FarsiFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>