2 Replies Latest reply: Jul 21, 2009 12:11 AM by 843810 RSS

    Displaying Arabic Text in JSP

    843810
      Hi All,

      Am developing an application which supports English & Arabic Languages.
      But in Arabic case, the pages shows junk values eg:???? after server hit.
      eg:- I typed some arabic text in textbox & click submit button, after server hit
      if any eeror occured it redirects to the same JSP page, in that case some junk
      values are displayed on my textbox.

      am using

      <%
           request.setCharacterEncoding("UTF-8");
           response.setContentType("text/html;charset=UTF-8");
      %>

      Please help me to solve this issue.
        • 1. Re: Displaying Arabic Text in JSP
          DrClap
          [Character Conversions from Browser to Database|http://java.sun.com/developer/technicalArticles/Intl/HTTPCharset/]
          • 2. Re: Displaying Arabic Text in JSP
            843810
            In addition to the setting the character encoding to UTF-8 in request and response objects, i think doing the following steps might also help.
            1. Set the charset of your jsp to UTF-8 : <%@ page contentType="text/html; charset=UTF-8" language="java"%>
            2. Either Set the Collation of the DB column you are using to save the arabic field to Arabic OR change the DB column to NVARCHAR

            You might also want to refer to the following links
            http://m-hewedy.blogspot.com/2009/01/enabling-arabic-in-java-web.html
            http://www.devx.com/Java/Article/30071/1954

            Hope this helps :)