Unicode support

Discussion in 'Java' started by zakasbanda@gmail.com, Oct 6, 2008.

  1. Guest

    Hello All

    I need some help from you folks. I want my J2EE webapp to accept
    international characters.

    Here is what I have done so far
    1. Wrote a filter that encodes request and response with UTF-8.
    2. Oracle is UTF-8.

    Now when I input a hindi character from the jsp page, and save it in
    database, I see characters in format. Here are my questions,
    1. Is it okay to see characters in this format in database?
    2. Now we escape (html) all are string text fields, which escape & and
    &#dddd shows as is on the browser, which is problem.

    Any help or suggestions will be appreciated.

    Thanks,
    -Sandy
     
    , Oct 6, 2008
    #1
    1. Advertising

  2. Mon, 6 Oct 2008 01:01:02 -0700 (PDT), //:

    > Now when I input a hindi character from the jsp page, and save it in
    > database, I see characters in format. Here are my questions,
    > 1. Is it okay to see characters in this format in database?
    > 2. Now we escape (html) all are string text fields, which escape & and
    > &#dddd shows as is on the browser, which is problem.


    It is a browser issue. For backwards compatibility browsers encode
    the submitted HTML form data using the document encoding, or if
    specified the encoding given in 'accept-charset' attribute of the
    FORM element (but I remember the later not working in all browsers
    sometime in the past). So whenever a character can't be encoded
    using the target encoding it is converted to a HTML character
    reference. The only sure thing in this case is to serve the HTML
    document using some UTF variant capable of encoding the entire
    Unicode repertoire.

    --
    Stanimir
     
    Stanimir Stamenkov, Oct 6, 2008
    #2
    1. Advertising

  3. Roedy Green Guest

    On Mon, 6 Oct 2008 01:01:02 -0700 (PDT), ""
    <> wrote, quoted or indirectly quoted someone who
    said :

    >Hello All
    >
    >I need some help from you folks. I want my J2EE webapp to accept
    >international characters.
    >
    >Here is what I have done so far
    >1. Wrote a filter that encodes request and response with UTF-8.
    >2. Oracle is UTF-8.
    >
    >Now when I input a hindi character from the jsp page, and save it in
    >database, I see characters in format. Here are my questions,
    >1. Is it okay to see characters in this format in database?
    >2. Now we escape (html) all are string text fields, which escape & and
    >&#dddd shows as is on the browser, which is problem.
    >
    >Any help or suggestions will be appreciated.


    The first thing I would do is have a look at the page sent to the
    browser.

    You should see something like this in it:

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

    Further, check that the Hindi characters in the page are indeed UTF-8
    encoded. See http://mindprod.com/jgloss/utf.html

    Then use Wireshark to snoop on the message from the browser to the
    server. See http://mindprod.com/jgloss/wireshark.html

    Make sure the browser is including UTF-8 as one of its preferred
    response encodings, and that message itself is UTF-8 encoded. See
    http://mindprod.com/jgloss/http.html

    In any problem the first job is to localise who is screwing up. Then
    you can work on correcting the problem.


    --
    Roedy Green Canadian Mind Products
    http://mindprod.com/politics/harper.html
    Anyone but Harper for Prime Minister of Canada
     
    Roedy Green, Oct 6, 2008
    #3
    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.

Share This Page