----------
From: "Craig R. McClanahan" cmcclanahan@mytownnet.com
To: Java Apache java-apache@list.working-dogs.com
Subject: Re: bug in HttpServletRequest.getCharacterEncoding()
Date: Tue, Jul 13, 1999, 9:27 AM
Vadim Tkachenko wrote:
> Martin Kuba wrote:
> >
> > Hi,
> > I think there is a bug in Apache JServ implementation of
> > javax.servlet.http.HttpServletRequest.getCharacterEncoding().
>
> /skipped/
>
> > You will get:
> > getCharacterEncoding() = ISO-8859-1
> > getCharacterEncoding() = iso-8859-2
> >
> > It is not correct. The request character encoding must be every
> > time ISO-8859-1 because HTTP protocol has no way to specify
> > request encoding. JServ uses encoding of response as encoding
> > of request, which may not be the same.
>
> Known since long ago, hopefully Craig fixed it in 1.1
>
In 1.0, the problem is actually much worse than you might think.
In the implementation, JServConnection implements both
HttpServletRequest and HttpServletResponse. Unfortunately, both of
these interfaces define a method named getCharacterEncoding()! The
implementation is the one for HttpServletOutput, so there is no way at
all to get the character encoding of the input.
In 1.1, the request and response implementations are separate. I
haven't tested these particular calls yet, but they should work -- they
try to parse any character encoding that was sent in the content-type
header on the input side, and include the character encoding you select
on the output side.
>
> > Martin
>
> --vt
>
Craig |