• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

how to get a Unicode form data

 
Ranch Hand
Posts: 798
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


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
Posts: 798
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 .
 
I guess I've been abducted by space aliens. So unprofessional. They tried to probe me with this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic