You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ki...@apache.org on 2002/06/21 01:48:23 UTC
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Validator.java
kinman 2002/06/20 16:48:23
Modified: jasper2/src/share/org/apache/jasper/compiler Validator.java
Log:
- Fixed 9996, and possibly 9993: set the default charset from the
pageEncoding if contentType specified does not include a charset.
Revision Changes Path
1.10 +12 -6 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Validator.java
Index: Validator.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Validator.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- Validator.java 5 Jun 2002 22:01:33 -0000 1.9
+++ Validator.java 20 Jun 2002 23:48:23 -0000 1.10
@@ -583,13 +583,19 @@
// Determine the default output content type, per errata_a
// http://jcp.org/aboutJava/communityprocess/maintenance/jsr053/errata_1_2_a_20020321.html
PageInfo pageInfo = compiler.getPageInfo();
- if (pageInfo.getContentType() == null) {
+ String contentType = pageInfo.getContentType();
+ if (contentType == null || contentType.indexOf("charset=") < 0) {
boolean isXml = page.getRoot().isXmlSyntax();
- String defaultType = isXml? "text/xml;": "text/html;";
+ String defaultType;
+ if (contentType == null) {
+ defaultType = isXml? "text/xml": "text/html";
+ } else {
+ defaultType = contentType;
+ }
String charset = pageInfo.getPageEncoding();
if (charset == null)
charset = isXml? "UTF-8": "ISO-8859-1";
- pageInfo.setContentType(defaultType + charset);
+ pageInfo.setContentType(defaultType + ";" + charset);
}
/*
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>