tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ethan Wallwork" <>
Subject RE: [BUG] Parameter value does not acquired when the value is mult-byte characters and when used in HTML anchor tag
Date Thu, 05 Oct 2000 23:07:37 GMT
I'm not sure if this is the same problem or not, but when we have has some
troubles with parameters with multi-byte characters.  The browser url-encodes
them before sending them to the browser.  It does this byte by byte using the
%xx notation.  When they get decoded, each byte gets turned into one character
(the byte being the low byte of the 2-byte char, the high byte is always 0). To
get the string back you need a bit of code like this:

public String decode( String param, encoding )
  // Java stores strings in Unicode
  byte[] orig = param.getBytes("Unicode");
  byte[] temp = new byte[(orig.length-2)/2];

  // skip the first two bytes which should be 0xff & 0xfe
  // and then collect all the "low" bytes
  for (int i = 2; i < orig.length; i+=2)
    temp[(i-2)/2] = orig[i];
  return new String(temp, encoding);

The browser should have encoded the characters using the same encoding as the
page they came from.

The reason it works for input tags is because your browser is probably
converting the chars to &#xxxx format, which it does not do for "raw"
characters embedded in your page.

Unfortunatly there seems to be no way to tell just from the request what
encoding the parameters are in.  You need to know something about the page the
request came from.  For portability, I would suggest using the &#xxxx format
for multi-byte characters in URL's.

I hope I got this right!

Ethan Wallwork

-----Original Message-----
From: ±èÀçÁ¾ []
Sent: Thursday, October 05, 2000 1:00 AM
Subject: [BUG] Parameter value does not acquired when the value is mult-byte
characters and when used in HTML anchor tag

Thanks for jakarta projects

BugRat ID = 216
os : linux redhat 6.2 x386 and apache

When I use html anchor tag to link to my suvlet that has parameter with
mult-byte character value I can not acquire the value correctly in my servlet
with HttpServletRequest functions like getParameter, etc.

example: ??
When the value is alpa-numeric It is correct but when the value is korean the
"v" always returned.

It works well with input tag.

referance: it works correctly in Jserv.

Please let me Know it is Bug or I am wrong.

 Your life on the net
DreamWiz Free Mail @
DreamSearch Click the world!!!

View raw message