aspose file tools*
The moose likes Servlets and the fly likes passing far east DBCS as a servlet parameter Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "passing far east DBCS as a servlet parameter" Watch "passing far east DBCS as a servlet parameter" New topic
Author

passing far east DBCS as a servlet parameter

Neil Goldsmith
Ranch Hand

Joined: Nov 02, 2001
Posts: 34
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 ]
stan ioffe
Greenhorn

Joined: Jun 30, 2005
Posts: 16
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: passing far east DBCS as a servlet parameter