Bug 43236 - Response.setCharacterEncoding() fails after Response.getWriter() and Response.reset()
Response.setCharacterEncoding() fails after Response.getWriter() and Response...
Product: Tomcat 5
Classification: Unclassified
Component: Catalina
All All
: P2 major (vote)
: ---
Assigned To: Tomcat Developers Mailing List
: 37072 (view as bug list)
Depends on:
  Show dependency tree
Reported: 2007-08-29 03:56 UTC by Olaf Meske
Modified: 2008-01-06 15:15 UTC (History)
1 user (show)


Note You need to log in before you can comment on or make changes to this bug.
Description Olaf Meske 2007-08-29 03:56:43 UTC
The class org.apache.catalina.connector.Response

resets the internal hold coyoteResponse and outputBuffer during reset():

    public void reset() {
        if (included)
            return;     // Ignore any call from an included servlet

but if anyone has already set the characterEncoding (e.g. to UTF-8) and already
got the writer, than all following invocations of request.setCharacterEncoding()
will do nothing, because the internal save flag for usingWriter is not reseted.
This is very annoying, because the coyoteResponse.reset(), resets the
characterEncoding to iso8859-1. So I have no change to change/reset the
charaterEncoding to UTF-8.
I'll think if you reset the response, you should also reset the usingWriter flag
or add another special flag, that works with this circumstances.
Comment 1 Mark Thomas 2007-12-18 15:48:50 UTC
This has been fixed in trunk and proposed for back port to 5.5.x and 6.0.x
Comment 2 Mark Thomas 2007-12-18 15:50:10 UTC
*** Bug 37072 has been marked as a duplicate of this bug. ***
Comment 3 Mark Thomas 2007-12-23 12:16:13 UTC
Fixed in 6.0.x
Comment 4 Mark Thomas 2008-01-06 15:15:53 UTC
Fixed in 5.5.x and will be included in 5.5.26 onwards.