Details
-
Type:
Bug
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: 1.2
-
Fix Version/s: None
-
Component/s: Export
-
Labels:None
Description
org.displaytag.filter.BufferedResponseWrapper13Impl.setCharacterEncoding(String) stupidly sets the content type without handling the char encoding correct. The specs of javax.servlet.ServletResponse.setContentType(String) clearly says:
{quote}
* Sets the content type of the response being sent to
* the client, if the response has not been committed yet.
* The given content type may include a character encoding
* specification, for example, <code>text/html;charset=UTF-8</code>.
* The response's character encoding is only set from the given
* content type if this method is called before <code>getWriter</code>
* is called.
* <p>This method may be called repeatedly to change content type and
* character encoding.
* This method has no effect if called after the response
* has been committed. It does not set the response's character
* encoding if it is called after <code>getWriter</code>
* has been called or after the response has been committed.
* <p>Containers must communicate the content type and the character
* encoding used for the servlet response's writer to the client if
* the protocol provides a way for doing so. In the case of HTTP,
* the <code>Content-Type</code> header is used.
{quote}
Tomcat's repsonse implementation does this clearly. This impl does not. I have patched the issue. Now it works as specified. This one is related to DISPL-471.
{quote}
* Sets the content type of the response being sent to
* the client, if the response has not been committed yet.
* The given content type may include a character encoding
* specification, for example, <code>text/html;charset=UTF-8</code>.
* The response's character encoding is only set from the given
* content type if this method is called before <code>getWriter</code>
* is called.
* <p>This method may be called repeatedly to change content type and
* character encoding.
* This method has no effect if called after the response
* has been committed. It does not set the response's character
* encoding if it is called after <code>getWriter</code>
* has been called or after the response has been committed.
* <p>Containers must communicate the content type and the character
* encoding used for the servlet response's writer to the client if
* the protocol provides a way for doing so. In the case of HTTP,
* the <code>Content-Type</code> header is used.
{quote}
Tomcat's repsonse implementation does this clearly. This impl does not. I have patched the issue. Now it works as specified. This one is related to DISPL-471.