• Post Reply Bookmark Topic Watch Topic
  • New Topic

Japansese characters offset problem  RSS feed

Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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


where XXXX is japanese characters (kanji)

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


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

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!