remm 02/02/20 22:06:35
Modified: catalina/src/share/org/apache/catalina/connector
ResponseBase.java
Log:
- Implement a more dynamic behavior for setting the charset.
- Patch submitted by Hans Bergsten.
Revision Changes Path
1.23 +14 -7
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/ResponseBase.java
Index: ResponseBase.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/ResponseBase.java,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- ResponseBase.java 20 Feb 2002 18:33:26 -0000 1.22
+++ ResponseBase.java 21 Feb 2002 06:06:35 -0000 1.23
@@ -1,7 +1,7 @@
/*
- * $Header:
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/ResponseBase.java,v
1.22 2002/02/20 18:33:26 remm Exp $
- * $Revision: 1.22 $
- * $Date: 2002/02/20 18:33:26 $
+ * $Header:
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/ResponseBase.java,v
1.23 2002/02/21 06:06:35 remm Exp $
+ * $Revision: 1.23 $
+ * $Date: 2002/02/21 06:06:35 $
*
* ====================================================================
*
@@ -89,7 +89,7 @@
*
* @author Craig R. McClanahan
* @author Remy Maucherat
- * @version $Revision: 1.22 $ $Date: 2002/02/20 18:33:26 $
+ * @version $Revision: 1.23 $ $Date: 2002/02/21 06:06:35 $
*/
public abstract class ResponseBase
@@ -891,11 +891,18 @@
return; // Ignore any call from an included servlet
this.locale = locale;
- if ((this.encoding == null) && (this.context != null)) {
+ if (this.context != null) {
CharsetMapper mapper = context.getCharsetMapper();
this.encoding = mapper.getCharset(locale);
- if ((contentType != null) && (contentType.indexOf(';') < 0)) {
- contentType = contentType + ";charset=" + encoding;
+ if (contentType != null) {
+ if (contentType.indexOf(';') < 0) {
+ contentType = contentType + ";charset=" + encoding;
+ } else {
+ // Replace the previous charset
+ int i = contentType.indexOf(';');
+ contentType = contentType.substring(0, i)
+ + ";charset=" + encoding;
+ }
}
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>