This week's book giveaway is in the General Computing forum.
We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
See this thread for details.
The moose likes Servlets and the fly likes Japansese characters offset problem Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Servlets
Reply Bookmark "Japansese characters offset problem" Watch "Japansese characters offset problem" New topic
Author

Japansese characters offset problem

saravanan kanda swamy
Ranch Hand

Joined: Apr 21, 2004
Posts: 33
Hi,

I have a problem in reading the japanese chracters from the form element. Acutally from one parameter I am reading the values like this

String strDetails = Request.getParameter("Details");
If that form field has only japanese character then everything is coming fine. But the requirements is it will have many details like Slno, Name,Address etc. I am getting that in the string and using the offset only i am identifying the parameters. Say slno will be from 1 to 2 and name will be in 3 to 20 and Address will be in 30 to 60.


I am separating the parameter like this.

String strNo = strDetails.subString(0,2);
String strUserName = strDetails.subString(2,20);
String strAddress = strDetails.subString(20,30);

The problem is like when i use the offset to get the values from the string the offset is getting changed if the request is coming from another (japanese)server. But when they print the request that have sent it is coming fine which means the offset is correct at their end including the japanese characters. But when it reaches the servlet then the offset is getting changed.

In detail if they send some 10 japanese characters it is coming here as 5 but the characters are same. I think this is problem due to double byte. They are sending Kanji characters. Instead of getting japanese characters i am also getting the some charaters from the address field also.

like if they send request like

http://ip:7001/request.do?Details=01XXXXYYYYYYY

where XXXX is japanese characters (kanji)

while it reaches my server i am getting the request like this

Details=01XXYYYYYYY

So when I try to get the values using the offset i am not able to get the values properly because of the offset. But when i try to print the values in the page it is coming fine.

Please help me how to resolve it.

Thanks in advance

Saravanan.K
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Japansese characters offset problem
 
Similar Threads
IBM DB2 AS400 data encoding issue
Few Doubts about encoding
Retrieving Japanese data from an access database
Conversion of Unicode to Kanji!
Japanese character from the request stored in question mark in the DB