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?
[ August 05, 2005: Message edited by: Neil Goldsmith ] [ August 05, 2005: Message edited by: Neil Goldsmith ]
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"