tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Clere, Jean-Frederic" <jfrederic.cl...@fujitsu.siemens.es>
Subject RE: [PATCH] for EBCDIC support in JSP
Date Mon, 29 May 2000 12:52:57 GMT
Hi,

It was exactly my idea. Specialy to have java sources in my native encoding.
The Mime type described in the SUN specifications concerns the response not
the JSP source files. I see no reason to have the same encoding... except
performances or spec's.

But if we look to XML <?xml encoding='EncName'?>, EncName is the encoding of
the document. We have to process a source file, we need to know what is
inside.

This does not exist in JSP this is why the "charset" is being used as
"encoding"!  
What should I do?

Jean-Frederic 

> -----Original Message-----
> From:	Fedor Karpelevitch [SMTP:fedor@simpata.com]
> Sent:	Saturday, May 20, 2000 3:51 AM
> To:	'tomcat-dev@jakarta.apache.org'
> Subject:	RE: [PATCH] for EBCDIC support in JSP
> 
> Hi!
> 
> for No. 1: I believe you misunderstood Jean-Frederic. AFAIU his patches
> are
> only dealing with java and jsp _sources_ on the server and how they are
> treated during _compilation_ and have nothing to do with data being sent
> to/from client. And that portion of the spec, I assume, applies to
> response.
> 
> WBR, Fedor.
>  
> Today: "The day Microsoft makes something that doesn't suck, is probably
> the
> day they start making vacuum cleaners..." 
> 
> 
> > -----Original Message-----
> > From: MANDAR RAJE [mailto:mandar@pathfinder.eng.sun.com]
> > Sent: Friday, May 19, 2000 11:38 AM
> > 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.j
> > ava   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/SunJav
> > aCompiler.java
> > > Fri Jan 21 05:17:22 2000
> > > +++ 
> > jakarta-tomcat/src/share/org/apache/jasper/compiler/SunJavaCom
> > piler.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