Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Accessing Japanese characters from text area

 
priby mathew
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Greetings to all,

I am having a JSP page with a textarea in it. I access the value entered in the text area using a servlet.

But when I type Japanese characters in the text area, in the servlet I am getting the value as '?'.

I even tried Request.setCharacterEncoding("ISO-2022-JP"); in the servlet before accessing the value from the text area. But still I am getting '?'.

Any help appreciated..

Thanks
priby
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I even tried Request.setCharacterEncoding("ISO-2022-JP"); in the servlet before accessing the value from the text area.

First, make sure that your html is set to the correct encoding. For example, if your page is EUC encoded, you should have :

or UTF-8:


But still I am getting '?'.

Where ? How are checking the content ?
[ March 10, 2008: Message edited by: Christophe Verre ]
 
priby mathew
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Christophe,

As you suggested I added the following lines in my JSP:



In the servlet I'm using the following code for fetching the value (which has japanese characters) from JSP and writing it to html file:


When I open the testing.html in IE browser, I see only '?' for Jaapanese characters... I even changed the encoding of IE to UTF-8..

Thanks
priby
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you using a get or a post for your form ?
 
priby mathew
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using POST for the form
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure of what will happen if you don't specify which encoding you are using for your file. There may be a better way to do it, but try this :
 
priby mathew
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Christopher,
I tried as you suggested and it s working now...

Thank you..


Regards,
Priby
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic