Saving Arabic Text

Discussion in 'Java' started by Khan, Apr 30, 2006.

  1. Khan

    Khan Guest

    Hi,

    I'm trying to save arabic text through sql query. I'm selecting text
    from a combo box and using the code "String test =
    request.getParameter("hidden"); "

    When i'm displaying a java message box the arabic text is displaying
    like boxes but when i'm displaying message using 'alert' in jsp, arabic
    is coming fine.

    Problem seems to be in "request.getParameter("hidden") .

    Plz advise some solution.

    Thanx.
    Khan, Apr 30, 2006
    #1
    1. Advertising

  2. Khan wrote:
    > I'm trying to save arabic text through sql query. I'm selecting text
    > from a combo box and using the code "String test =
    > request.getParameter("hidden"); "
    >
    > When i'm displaying a java message box the arabic text is displaying
    > like boxes but when i'm displaying message using 'alert' in jsp, arabic
    > is coming fine.
    >
    > Problem seems to be in "request.getParameter("hidden") .


    I'm not very clear on either what you want to happen or on what is
    actually happening. I'm particularly confused as to where an SQL query
    fits in, as everything else you mention seems to pertain to a web API.
    Do you perhaps mean an *HTTP* query? Most of my comments below assume
    that you do, indeed, mean HTTP.

    I might be able to offer better-targeted advice if I had more
    information, but here are some general considerations:

    () Your problem very likely results from a character encoding problem.
    Both client and server must agree on the character encoding; otherwise
    character data transferred between them will be garbled.

    () When displaying the text, there is an entirely separate question of
    whether the font in use contains glyphs for the characters you are
    trying to display. The fact that the system may have such fonts
    installed does not imply that they will be used to display your text.

    () The default character encoding for HTTP is ISO-8859-1, which has no
    code points for Arabic characters. If you are using standard browsers
    and not doing anything special in your servlet or JSP then it is
    possible that either the client, the server, or both are assuming this
    encoding. Even if both agreed on ISO-8859-1, that would probably
    *still* garble Arabic text.

    () Some of the things you probably need to do involve configuring the
    HTTP message carrying the HTML page in which the form is delivered, and
    the adjusting details of the form itself: (1) The HTTP message should be
    encoded with a charset that supports the characters you need; UTF-8 is a
    good general-purpose choice. (2) The relevant FORM element should have
    an accept-charset attribute that specifes (only) the charset you want
    the client to use to encode the response. The charset specified in (2)
    does not need to be the same as the one described in (1), though it's
    probably easier if it is.

    () The servlet / JSP might need to specify the charset to use to read
    the query; see ServletRequest.setCharacterEncoding().


    --
    John Bollinger
    John C. Bollinger, May 2, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. mansour via DotNetMonster.com

    when i try to insert or update text in arabic it appears "????"

    mansour via DotNetMonster.com, Sep 11, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    770
    Juan T. Llibre
    Sep 11, 2005
  2. Alex Nazarian

    Arabic Text Rendering

    Alex Nazarian, Oct 26, 2004, in forum: Java
    Replies:
    9
    Views:
    5,390
    Andrew Thompson
    Oct 28, 2004
  3. Swetha
    Replies:
    16
    Views:
    7,492
    Roedy Green
    Dec 13, 2005
  4. Swetha
    Replies:
    10
    Views:
    8,598
    sajitha
    Oct 11, 2007
  5. Replies:
    3
    Views:
    12,328
    Martin Honnen
    Mar 1, 2005
Loading...

Share This Page