Unicode characters in URL

Discussion in 'Java' started by Vijay, Jun 20, 2005.

  1. Vijay

    Vijay Guest

    hi all,

    I have a servlet which takes in a name in the URL.
    http://localhost/myServlet.123?name=blah

    When this name contains unicode characters, then my ActionForm gets
    different characters, not the ones posted. (On the status bar of IE6.0,
    I can see that the URL contains the right value of the name). It seems,
    while transmitting the get request, the name's value gets changed.

    In the form's post request, everything works well.

    Can anybody point out what is wrong here?

    Thanks for any help...
    Vijay, Jun 20, 2005
    #1
    1. Advertising

  2. Vijay

    Mickey Segal Guest

    "Vijay" <> wrote in message
    news:...
    > I have a servlet which takes in a name in the URL.
    > http://localhost/myServlet.123?name=blah
    >
    > When this name contains unicode characters, then my ActionForm gets
    > different characters, not the ones posted. (On the status bar of IE6.0,
    > I can see that the URL contains the right value of the name). It seems,
    > while transmitting the get request, the name's value gets changed.


    Are you doing both URL and UTF encoding for output going to the servlet?
    Are you using something like:
    req.setCharacterEncoding("UTF-8");
    in the receiving servlet?
    Mickey Segal, Jun 20, 2005
    #2
    1. Advertising

  3. Vijay

    Vijay Guest

    hi Segal,

    java.net.URLDecoder.decode("%E6%AC%80%E6%AC%A8%E6%AD%81%E6%AB%BB%E6%AC%B8%E6%AD%A7.doc","UTF-8")
    gives me the right value for the name.

    However, it seems that when struts populates the name field in the
    ActionForm, it is not using the UTF-8 Encoding. I have also specified
    UTF-8 encoding using request.setCharacterEncoding("UTF-8"). Is there a
    workaround for this?

    Thanks,
    Vijay, Jun 21, 2005
    #3
  4. Vijay

    Mickey Segal Guest

    "Vijay" <> wrote in message
    news:...
    > hi Segal,
    >
    > java.net.URLDecoder.decode("%E6%AC%80%E6%AC%A8%E6%AD%81%E6%AB%BB%E6%AC%B8%E6%AD%A7.doc","UTF-8")
    > gives me the right value for the name.
    >
    > However, it seems that when struts populates the name field in the
    > ActionForm, it is not using the UTF-8 Encoding. I have also specified
    > UTF-8 encoding using request.setCharacterEncoding("UTF-8"). Is there a
    > workaround for this?


    Perhaps others will be more familiar with the details of your environment.
    Mickey Segal, Jun 21, 2005
    #4
    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. Laszlo Nagy
    Replies:
    6
    Views:
    610
  2. Terry Reedy
    Replies:
    0
    Views:
    507
    Terry Reedy
    Jul 1, 2008
  3. M.-A. Lemburg
    Replies:
    0
    Views:
    888
    M.-A. Lemburg
    Jul 2, 2008
  4. Grzegorz ¦liwiñski
    Replies:
    2
    Views:
    958
    Grzegorz ¦liwiñski
    Jan 19, 2011
  5. mpyles
    Replies:
    1
    Views:
    133
    Steven Burn
    Jun 9, 2004
Loading...

Share This Page