tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From MANDAR RAJE <man...@pathfinder.eng.sun.com>
Subject Re: [PATCH] for EBCDIC support in JSP
Date Tue, 30 May 2000 17:08:49 GMT
"Clere, Jean-Frederic" wrote:
> 
> 1 )
>   ISO-8859-1, Ooops... You are right, Do you think charset=native could be
> proposed? (It would help for our BS2000 machines, that have there own
> EBCDIC).
> 

 That is a specification issue and will have to be dealt there. You
can try sening a mail to jsp-spec-comments@sun.com


> 2 )
>   I have to tried it. I will report the result.


 Thanks. Let me know.

Mandar.
  
> 
> Thanks
> 
> Jean-Frederic
> 
> > -----Original Message-----
> > From: MANDAR RAJE [SMTP:mandar@pathfinder.eng.sun.com]
> > Sent: Friday, May 19, 2000 8:38 PM
> > To:   tomcat-dev@jakarta.apache.org
> > Subject:      Re: [PATCH] for EBCDIC support in JSP
> >
> >
> >  I am not an expert in encoding, so most of the work has
> > been through trial and error except for what is specified
> > in the spec.
> >
> > 1) The spec. clearly says that in case where there is
> >    no contentType specified for a JSP page the default is
> >    "ISO-8859-1". So we can't really do anything about that.
> >
> > 2) For the Java Source File Encoding the UTF-8 worked
> >    across different contentTypes and across multiple
> >    locales (tried on Japanese NT and it worked).
> >
> >  There has been a known problem of non-Latin encoded data
> >  getting corrputed when sent through HTML forms (atleast in
> >  previous versions of Tomcat). I think this issue is still
> >  being doscussed on the list.
> >
> > Mandar.
> >
> > "Clere, Jean-Frederic" wrote:
> > >
> > > Hi,
> > >
> > > I have got a running JSP (At least the examples) by changing 3 files in
> > > jakarta-tomcat/src/share/org/apache/jasper/compiler.
> > > The  problem was the following:
> > > JSP files are in EBCDIC (gnujsp support them like that).
> > > JAVA files are in EBCDIC (That the default for source files!).
> > >
> > > Why in Compiler.java, JspReader.java and SunJavaCompiler.java we are
> > forcing
> > > javac -encoding UTF8, that way in EBCDIC the java (source) files are not
> > > readable.
> > > What is good is jspEncoding, I have forced default encoding, but
> > probably we
> > > should reuse some code to find the jsp encoding, except if agreed that
> > these
> > > file are always in the machine encoding (They are source files, are n't
> > > they?).
> > >
> > > Cheers
> > >
> > > Jean-Frederic
> > >
> > >  <<jsp.patch>>
> > > ---
> > cvs/jakarta-tomcat/src/share/org/apache/jasper/compiler/Compiler.java
> > > Tue Apr 25 20:28:20 2000
> > > +++ jakarta-tomcat/src/share/org/apache/jasper/compiler/Compiler.java
> > Fri
> > > May 19 19:10:50 2000
> > > @@ -155,7 +155,7 @@
> > >             JspReader tmpReader = JspReader.createJspReader(
> > >
> > > ctxt.getJspFile(),
> > >                                                             ctxt,
> > > -
> > jspEncoding);
> > > +                                                           null);
> > >             String newEncode = changeEncodingIfNecessary(tmpReader);
> > >             if (newEncode != null) jspEncoding = newEncode;
> > >         }
> > > @@ -163,14 +163,15 @@
> > >          JspReader reader = JspReader.createJspReader(
> > >              ctxt.getJspFile(),
> > >              ctxt,
> > > -            jspEncoding
> > > +            null
> > >          );
> > >
> > > +       // do not Specify the encoding to OutputStreamWriter, otherwise
> > the
> > > java file is not in the native format: it is unreadable in EBCDIC.
> > >          ServletWriter writer =
> > >              (new ServletWriter
> > >                  (new PrintWriter
> > >                      (new java.io.OutputStreamWriter(
> > > -                        new
> > > FileOutputStream(javaFileName),javaEncoding))));
> > > +                        new FileOutputStream(javaFileName)))));
> > >
> > >          ctxt.setReader(reader);
> > >          ctxt.setWriter(writer);
> > > @@ -192,8 +193,9 @@
> > >          String sep = System.getProperty("path.separator");
> > >          String[] argv = new String[]
> > >          {
> > > -            "-encoding",
> > > -            javaEncoding,
> > > +           // If we use default encoding (native) we do not need the
> > > "-encoding arguement.
> > > +            //"-encoding",
> > > +            //javaEncoding,
> > >              "-classpath",
> > >              System.getProperty("java.class.path")+ sep + classpath
> > >              + sep + ctxt.getOutputDir(),
> > > ---
> > cvs/jakarta-tomcat/src/share/org/apache/jasper/compiler/JspReader.java
> > > Thu May  4 23:37:21 2000
> > > +++ jakarta-tomcat/src/share/org/apache/jasper/compiler/JspReader.java
> > Fri
> > > May 19 16:51:29 2000
> > > @@ -156,12 +156,7 @@
> > >         throws ParseException, FileNotFoundException
> > >      {
> > >          // Default encoding if needed:
> > > -       if (encoding == null) {
> > > -            encoding = "8859_1";
> > > -            // XXX - longer term, this should really be:
> > > -           //   System.getProperty("file.encoding", "8859_1");
> > > -            // but this doesn't work right now, so we stick with ASCII
> > > -        }
> > > +       // If encoding is null then use the default encoding (native).
> > >
> > >         // Register the file, and read its content:
> > >         String longName = (context == null)
> > > @@ -179,9 +174,13 @@
> > >
> > >         InputStreamReader reader = null;
> > >         try {
> > > -            if (context == null)
> > > -                reader = new InputStreamReader(new
> > FileInputStream(file),
> > > -                                               encoding);
> > > +            if (context == null) {
> > > +               if (encoding == null)
> > > +                     reader = new InputStreamReader(new
> > > FileInputStream(file));
> > > +               else
> > > +                     reader = new InputStreamReader(new
> > > FileInputStream(file),
> > > +                                                    encoding);
> > > +               }
> > >              else {
> > >                 String fileName = context.getRealPath(file.toString());
> > >                  InputStream in = new FileInputStream(fileName);
> > > @@ -189,7 +188,10 @@
> > >                      throw new FileNotFoundException(fileName);
> > >
> > >                  try {
> > > -                    reader = new InputStreamReader(in, encoding);
> > > +                   if (encoding == null)
> > > +                       reader = new InputStreamReader(in);
> > > +                   else
> > > +                       reader = new InputStreamReader(in, encoding);
> > >                  } catch (Throwable ex) {
> > >                      throw new FileNotFoundException(fileName + ": "+
> > > ex.getMessage());
> > >                  }
> > > ---
> > >
> > cvs/jakarta-tomcat/src/share/org/apache/jasper/compiler/SunJavaCompiler.ja
> > va
> > > Fri Jan 21 05:17:22 2000
> > > +++
> > jakarta-tomcat/src/share/org/apache/jasper/compiler/SunJavaCompiler.java
> > > Fri May 19 16:41:49 2000
> > > @@ -129,7 +129,7 @@
> > >
> > >          String[] args = new String[]
> > >          {
> > > -            "-encoding", encoding,
> > > +            // "-encoding", encoding, use default encoding
> > >              "-classpath", classpath,
> > >              "-d", outdir,
> > >              source
> > >
> > >
> > ------------------------------------------------------------------------
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org

Mime
View raw message