This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes JSP and the fly likes how to get a Unicode form data Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "how to get a Unicode form data " Watch "how to get a Unicode form data " New topic
Author

how to get a Unicode form data

Edward Chen
Ranch Hand

Joined: Dec 23, 2003
Posts: 798


I try to get a form data which input is Chinese. I did that coding above, but it doesn't work. It show up junk . All possible ways are done , still not work.

Could you help me ? tell me where is my coding bug.

Thanks
Edward Chen
Ranch Hand

Joined: Dec 23, 2003
Posts: 798
Yes, I got the answer. The last try.

it should be
name1 = new String(name.getBytes("8859_1"),"UTF-8");

But I don't know why. Why I can't use "UTF8", because the page encoding is UTF8. and I set the request character encoding as "UTF8" . Why I should pick "8859_1", it is because my request locale is "en_US" ? if yes, in the future coding, how could I know user request locale ? what is the relationship between locale and encoding (eg,"UTF8") ?

The problem is done, more problems are up.

Thanks .
 
jQuery in Action, 2nd edition
 
subject: how to get a Unicode form data