users@glassfish.java.net

Re: Can't set charset to UTF-8

From: Ryan Lubke <Ryan.Lubke_at_Sun.COM>
Date: Fri, 09 Nov 2007 09:18:15 -0800

Gerald Holl wrote:
> Jan.Luehe_at_Sun.COM wrote:
>> Gerald,
>>
>> Gerald Holl wrote:
>>
>>> Hello,
>>>
>>> I'm having troubles setting the charset to UTF-8 on Glassfish:
>>> [#|2007-11-07T14:38:01.059+0100|WARNING|sun-appserver9.1|org.apache.coyote.tomcat5.CoyoteRequest|_ThreadID=18;_ThreadName=httpSSLWorkerThread-8080-1;_RequestID=aa139129-bed8-45a9-adb5-d099637fcdf8;|PWC4011:
>>> Unable to set request character encoding to ISO-8859-1 from context
>>> /myapp, because request parameters have already been read, or
>>> ServletRequest.getReader() has already been called|#]
>>>
>>> I'm confused why the server complains about the ISO-8859-1 character
>>> encoding.
>>
>>
>> The container does not complain about the encoding itself, only about
>> the fact
>> that you are trying to set the encoding too late, when it is
>> impossible for the container
>> to honor it.
>>
>> See the javadocs of ServletRequest.setCharacterEncoding():
>>
>> This method must be called prior to reading request parameters
>> or reading input using getReader(). Otherwise, it has no effect.
>>
>> The container issues a warning to let you know that your call to
>> ServletRequest.setCharacterEncoding() has no effect, because one of
>> the above conditions is met.
>>
>> You should move your call to ServletRequest.setCharacterEncoding()
>> before you acquire an input reader from the request, and before
>> you read any request parameters.
>
> Hello Jan,
>
> Thanks for your response.
>
> I didn't implement a servlet my own, I just use JSF and JSP. So I
> don't call ServletRequest.setCharacterEncoding() at any time.
There was an issue [1] in JSF that would cause this message to occur,
but this particular case should be resolved
in GFv2.

What version of GF/JSF are you using? Can you please describe your
setup and what sequence of events trigger
this message?
>
> cheers,
> Gerald
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>