UTF-8 encoded strings in form fields of a Struts based web-app

Discussions

Web tier: servlets, JSP, Web frameworks: UTF-8 encoded strings in form fields of a Struts based web-app

  1. Hi,
    There are some UTF-8 encoded strings selected from DB and stored in fields of a formBean. These are in Persian(Farsi) and there's a problem in showing them in fields of the corresponding html form. Something like ??? was shown instead of تست after running the application.
    What could be wrong with it?

    Thanks
  2. I think you need to set the appropriate content type for UTF-8 in the response object and also if you use <html:write>, you may have to use filter="false" option.

    response.setContentType("text/html;charset=utf-8");

    Hope this helps,
    Senthil.