cvs commit: jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler JspParseEventListener.java ParserController.java

2001-04-09 Thread horwat

horwat  01/04/09 16:38:12

  Modified:jasper/src/share/org/apache/jasper/compiler
JspParseEventListener.java ParserController.java
  Log:
  Change default character encoding to: ISO-8859-1
  
  Bugzilla #1181
  
  Revision  ChangesPath
  1.24  +4 -4  
jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/JspParseEventListener.java
  
  Index: JspParseEventListener.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/JspParseEventListener.java,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- JspParseEventListener.java2001/03/27 23:56:24 1.23
  +++ JspParseEventListener.java2001/04/09 23:38:12 1.24
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/JspParseEventListener.java,v
 1.23 2001/03/27 23:56:24 horwat Exp $
  - * $Revision: 1.23 $
  - * $Date: 2001/03/27 23:56:24 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/JspParseEventListener.java,v
 1.24 2001/04/09 23:38:12 horwat Exp $
  + * $Revision: 1.24 $
  + * $Date: 2001/04/09 23:38:12 $
*
* 
*
  @@ -352,7 +352,7 @@
else
writer.println("response.setContentType(\"" +
   servletContentType +
  -";charset=8859_1\");");
  +";charset=ISO-8859-1\");");
writer.println("pageContext = _jspxFactory.getPageContext(this, request, 
response,\n"
+ "\t\t\t"
+ writer.quoteString(error) + ", "
  
  
  
  1.14  +2 -2  
jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/ParserController.java
  
  Index: ParserController.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/ParserController.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- ParserController.java 2001/03/21 00:27:01 1.13
  +++ ParserController.java 2001/04/09 23:38:12 1.14
  @@ -122,9 +122,9 @@
   /*
* The encoding of the "top" file. This encoding is used
* for included files by default.
  - * Defaults to "8859_1" per JSP spec.
  + * Defaults to "ISO-8859-1" per JSP spec.
*/
  -private String topFileEncoding = "8859_1"; 
  +private String topFileEncoding = "ISO-8859-1"; 
   
   /*
* The 'new' encoding required to read a page.
  
  
  



cvs commit: jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler JspParseEventListener.java ParserController.java

2000-12-22 Thread pierred

pierred 00/12/22 10:37:40

  Modified:jasper/src/share/org/apache/jasper/compiler
JspParseEventListener.java ParserController.java
  Log:
  Fix for Bug #55.
  
 -
 Synopsis:
   Default for included files is 8859_1, with no option to set otherwise.
  
 Report Description:
   The default for reading an included file is ISO_8859_1. We can,
   of course, set pageConent to read UTF-8 (which is what we need it
   to be to support international
  code). Unfortunately, when there are two or more levels of
  encoding (or the pageContent type ins't set), the encoding that
  the JspReader gets set to a hard-coded
   "ISO_8859_1", and doesn't allow this to be set to anything else
   via the runtime system properties. In:
   org.apache.jasper.compiler.JspReader JspReader.java line
   158, encoding ALWAYS defaults to 8859_1, and the file.encoding,
   when set from the System properties. This is an easy fix, to set
   encoding to: encoding =
   System.getPropert("file.encoding","8859_1") ; The result,
   typically, is that the file will flake out and convert all of the
   non-UTF-8 characters to US-ASCII, @%, etc.
   -
  
  I'm not sure I fully understand what's described there,
  so here is what I believe should be done.
  
  The "encoding" for a JSP file is currently handled as follows:
  
  1. In Compiler.java, we create a JspReader for the top-level
 ("including") jsp file using the 8859_1 encoding.
  
  2. Using that JspReader, we check if there is a page directive
 with 'contentType' specified. If there is, then
 a new JspReader for the page is created with the encoding set to the
 "charset" specified in the contentType value of the page
 directive; otherwise we stick with the default 8859_1 encoding.
  
  3. When a page is included, JspReader.pushFile() is called,
 and the encoding passed as argument appears to always
 be null (since no encoding attribute can be specified in
 the "include" directive, reading 'encoding' off of the
 attributes appears to be a bug in JspParseEventListener).
 Because it is null, it always defaults to 8859_1.
  
  If I understand well the intent of the bug report, we'd need the
  following modifications:
  
  - In step 2, if contentType is not specified in the "including" page,
set the encoding to be:
  
   encoding = System.getProperty("file.encoding", "8859_1");
  
This means that the default encoding of all JSP files at a site could
be defined globally using system property "file.encoding".
I don't think this is spec-compliant, and would be reluctant
to make that change.
  
-- Change not done
  
Comments from Hans Bergsten
"I agree that using "file.encoding" as the ultimate default is not
 spec compliant. I suggest you stick to the current behavior, with
 "8859_1" if contentType doesn't specify a charset."
  
  - In step 3, use the encoding of the "including" page.
  
This would fix what I believe is a bug in the current implementation.
  
-- Change done
  
  Submitted by: [EMAIL PROTECTED]
  
  Revision  ChangesPath
  1.20  +4 -6  
jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/JspParseEventListener.java
  
  Index: JspParseEventListener.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/JspParseEventListener.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- JspParseEventListener.java2000/12/21 23:16:41 1.19
  +++ JspParseEventListener.java2000/12/22 18:37:39 1.20
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/JspParseEventListener.java,v
 1.19 2000/12/21 23:16:41 pierred Exp $
  - * $Revision: 1.19 $
  - * $Date: 2000/12/21 23:16:41 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/JspParseEventListener.java,v
 1.20 2000/12/22 18:37:39 pierred Exp $
  + * $Revision: 1.20 $
  + * $Date: 2000/12/22 18:37:39 $
*
* 
*
  @@ -750,8 +750,6 @@
   
if (directive.equals("include")) {
String file = attrs.getValue("file");
  - String encoding = attrs.getValue("encoding");
  -
if (file == null)
throw new CompileException(start,
   
Constants.getString("jsp.error.include.missing.file"));
  @@ -766,7 +764,7 @@
   }
*/
try {
  - parserCtl.parse(file, encoding);
  + parserCtl.parse(file);
} catch (FileNotFoundException ex) {
throw new CompileException(
   start,
  
  
  
  1.9