Re: [OT] JSP parameter frustration
Tony Field <[email protected]> Wed, 5 Jul 2006 17:51:36 -0400
| Newsgroups | gmane.text.xml.resin.user |
|---|---|
| Message-ID | <[email protected]> |
That's what I meant, yes. getBytes() uses the platform's default
character set to convert the characters into bytes. If that's not
the same as the encoding that you're expecting you could run into a
mismatch.
Specify the encoding in the getBytes() method and you'll probably get
what you wanted.
Tony
On 5-Jul-06, at 3:52 PM, Eric Carlson wrote:
> On Wed, 5 Jul 2006 14:16:43 -0400, you wrote:
>
>> The servlet container is responsible for decoding the parameters for
>> you before it sets them into the HttpServletRequest object, so don't
>> double-decode it.
>>
>> Tony
>
> Thanks. If I undersand you, thats means I should use this
>
> String param = request.getParameter("p");
> byte[] paramArray = param.getBytes();
> for (int i =0; i<param.length(); i++) {
> System.out.print(paramArray[i]);
> }
>
> (Which I actually started with) - but it still gives the wrong values.
>
>