Switch to full style
Java2 codes,problems ,discussions and solutions are here
Post a reply

Arabic Support in JSF

Fri Oct 24, 2008 9:51 pm

I have a problem in JSF. I can put arabic text in the pages but when the user
enters any arabic words and when the page refreshes the arabic text the user
entered changed to rubish characters.

I guess it is a problem in encoding but i was told the solution to this to make
the encoding UTF-8, but still not working.

Any suggestions?



Re: Arabic Support in JSF

Fri Oct 24, 2008 9:52 pm

I solved the problem using a filter that ensures that the character encoding is
UTF-8:

Code:
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
// TODO Auto-generated method stub
request.setCharacterEncoding("UTF-8");
response.setCharacterEncoding("UTF-8");
response.setContentType("text/html;charset=utf-8");
chain.doFilter(request, response);
}

Code:
<filter>
<description>
Setting the character encoding of the request</description>
<display-name>
RequestEncodingFilter</display-name>
<filter-name>RequestEncodingFilter</filter-name>
<filter-class>CharacterEncodingFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>RequestEncodingFilter</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>


Post a reply
  Related Posts  to : Arabic Support in JSF
 Arabic website partner     -  
 Read Arabic text from file     -  
 Looking for IT Support Job     -  
 Looking for Work in IT Support     -  
 Browser Support     -  
 AJAX - Browser support     -  
 Component subclasses that support painting     -  
 Support Vector Machine coding on Matlab...     -  
 java.util classes and interfaces support event handling     -  

Topic Tags

Java JSF