Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

Problem with i18n:jsp,struts,utf-8

  Asked By: Phil    Date: Jun 18    Category: Java    Views: 2078

I have a problem with i18n in my project(for persian/farsi language l10n).
I get "?" marks instead of UTF-8 characters in browser.
APIs and tools which I use are:jsp,tiles,struts
,struts message resourses,native2ascii,UTF-8 and also I use windows XP.

in a nutshell I`ve used one seprate ApplicationPropeties_fa for farsi
also I`ve changed locale to farsi but while compling the
ApplicationResource_fa,it convert to?.
any assitance would be appriciated in advance.



3 Answers Found

Answer #1    Answered By: Rosalie Holmes     Answered 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



//myLog.info(this.getClass().getName() + ": Setting request to " +

// request.getCharacterEncoding());




You also need to define your filter in web.xml such as this:








Answer #2    Answered By: Zachary Larson     Answered On: Jun 18

Please see this link :


Just consider codes,I hope it will be useful

Answer #3    Answered By: Ali Shahriari Garaei     Answered On: May 20

I had almost the same problem but i use Spring. I have solved it as here below:

put in your xml :

<bean id="messageSource"
<property name="basename" value="classpath:messages"></property>
<property name="defaultEncoding" value="UTF-8"></property>

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.