tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Thomas <ma...@apache.org>
Subject Re: CharacterEncoding is overridden by setContentType
Date Thu, 09 Dec 2010 11:27:57 GMT
On 09/12/2010 10:58, Ben wrote:
> Hi there,
> 
> I don't get the source code from Tomcat 7.0.5.
> 
> In the javadoc it says:
> --This method must preserve any response charset that may already have 
> --     * been set via a call to response.setContentType(), response.setLocale(),
> --     * or response.setCharacterEncoding().

If you are going to quote the source code, it is a good idea idea to
mention which class you are quoting. I know the code pretty well and it
still took me a couple of minutes to figure out where you were looking.

> But in the code attahced I cannot see any code related to check if the charset has been
set. What's the problem here? Thanks.

The JavaDoc comment means "If setContentType("text/plain") is called
that should not undo a previous call to
setCharacterEncoding("ISO-8859-1"). However, a call to
setContentType("text/plain;charset=UTF-8") *will* overwrite any previous
call to setCharacterEncoding("ISO-8859-1")

Mark


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message