Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Phil Sanchez   on Jun 18 In Java Category.

  
Question Answered By: Rosalie Holmes   on Jun 18

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>

Share: 

 

This Question has 2 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Problem with i18n:jsp,struts,utf-8 Or get search suggestion and latest updates.


Tagged: