• 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
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

passing far east DBCS as a servlet parameter

 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
We have 2 servlets that talk to one another. The first servlet needs to pass a string over to the 2nd as a parameter in a GET request. This string may contain far east Double byte characters (Korean, Japanese, S. Chinese)

We first encode the data using UTF-8. I tested that I could encode and decode this before sending and got back the correct Korean characters.

When I recieve the data by the 2nd servlet, it decodes everything correctly EXCEPT the double byte characters. Those come back as ??? . I have attempted a POST request, but both seem to fail.

My code for the sending servlet looks like this:


The receiving servlet just does this:


Pretty straightforward. Like I said, the decoding works fine unless it is Double Byte characters and then it can't handle them.

Is there anyway to custom parse the parameters myself? It appears the decoding is not working.

Am I doing something wrong? Can you pass double byte characters encoded with UTF-8 this way?

thanks

[ August 05, 2005: Message edited by: Neil Goldsmith ]
[ August 05, 2005: Message edited by: Neil Goldsmith ]
 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think you're having a problem because the receiving servlet is failing to set the correct contentType.

the doGet or doPost methods MUST set the contentType as the first step for the charset to take affect. If this method (res.setContentType()) is not called, the content type is assumed to be "text/html"

-Stan
 
Lasagna is spaghetti flvored cake. Just like this tiny ad:
New web page for Paul's Rocket Mass Heaters movies
https://coderanch.com/t/785239/web-page-Paul-Rocket-Mass
reply
    Bookmark Topic Watch Topic
  • New Topic