You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Kevin Jones <ke...@develop.com> on 2002/01/30 18:41:48 UTC

pageEncoding and Jasper

If I add a 

<%@ page pageEncoding="windows-1256" %>

(or any pageEncoding)

What does Jasper do with this? I would expect this to be set on the
content-type header but it's not. Jasper certainly parses the parameter
and fails if I put an invalid value in there, I just can't get it to do
anything. I can't use

<%@ page contentType="text/html; charset=windows-1256" %>

I have to use 

<META HTTP-EQUIV="content-type" CONTENT="text/html;
charset=windows-1256">

Some of this might seem like a user question, but I'm more concerned
about how Jasper works and what it should be doing.

Thanks,

Kevin Jones
Developmentor
www.develop.com 


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: pageEncoding and Jasper

Posted by jean-frederic clere <jf...@fujitsu-siemens.com>.
yoko@netpotlet.com wrote:
> 
> From: "Craig R. McClanahan" <cr...@apache.org>
> Subject: Re: pageEncoding and Jasper
> Date: Thu, 7 Feb 2002 20:02:00 -0800 (PST)
> Message-ID: <20...@icarus.apache.org>
> 
> > > > If "it" is the pageEncoding attribute of the <%@ page %> directive, then
> > > > the answer is yes.
> > >
> > > Craig, the answer is "no".
> >
> > Well, that's not the answer given by the JSP Specification ;-).
> 
> At this point, I agree with you. So, I should say "partially no".
> There are 2 phases from .jsp to .class, the first one is from
> .jsp to .java, and the second is from .java to .class. The pageEncoding
> attribute is applied to the first phase only as the JSP Specification
> stated, and for the second phase, container applies UTF-8 only.
> 
> > In the JSP 1.2 spec, see section 2.10.1, Table JSP.2-1, bottom of page 52,
> > where the "pageEncoding" attribute is defined:
> >
> >   Defines the character encoding of the JSP page.
> 
> I've read this, and I knew the role of the pageEncoding attribute.
> Though it is convenient that .java is written by UTF-8 because .java
> file becomes completely readable,

On a EBCDIC platfrom it is not very easy to read UTF-8 or ASCII ;-))

> I believe that the unicode escape is
> more natural in Java. Besides, container doesen't need any encoding
> information from .java to .jsp if non-ascii characters are converted
> to the unocde escape. Why the JSP Specification doesn't mention about
> UTF-8 is used internally. Is this a Tomcat specific technique ?
> 
> > If you want to tell the container what character encoding to send on a
> > response, use the "contentType" attribute of the <%@ page %> directive:
> >
> >   <%@ page contentType="text/html;charset=UTF-8" %>
> 
> I appreciate this function. The appropriate encoding management is that
> every encodings in every phases including an input/output stream should
> be controllable.
> And now, JSP pages became to be a platform independant document.

If JSP are like source files they could be in the machine default encoding.

> 
> > I had to do this in my Struts demo at JavaOne Japan, for example, in
> > order to display the Japanese characters correctly.  Setting pageEncoding
> > would not have done this.
> 
> If the pageEncoding is not set, container applies encoding specifed in
> contentType attribute, isn't it ? And, if the contentType is not set or
> has no charset part, container applies ISO-8859-1 as I think UTF-8
> should be applied. UTF-8 is the most suitable encoding for a default,
> because it is a language independent encoding.

The spec's say ISO-8859-1.

> 
> ---
> Yoko Kamei Harada, Web Studio Ne-Po-Le
> http://www.netpotlet.com/
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: pageEncoding and Jasper

Posted by yo...@netpotlet.com.
From: "Craig R. McClanahan" <cr...@apache.org>
Subject: Re: pageEncoding and Jasper
Date: Thu, 7 Feb 2002 20:02:00 -0800 (PST)
Message-ID: <20...@icarus.apache.org>

> > > If "it" is the pageEncoding attribute of the <%@ page %> directive, then
> > > the answer is yes.
> >
> > Craig, the answer is "no".
> 
> Well, that's not the answer given by the JSP Specification ;-).

At this point, I agree with you. So, I should say "partially no".
There are 2 phases from .jsp to .class, the first one is from 
.jsp to .java, and the second is from .java to .class. The pageEncoding
attribute is applied to the first phase only as the JSP Specification
stated, and for the second phase, container applies UTF-8 only.

> In the JSP 1.2 spec, see section 2.10.1, Table JSP.2-1, bottom of page 52,
> where the "pageEncoding" attribute is defined:
> 
>   Defines the character encoding of the JSP page.

I've read this, and I knew the role of the pageEncoding attribute.
Though it is convenient that .java is written by UTF-8 because .java
file becomes completely readable, I believe that the unicode escape is
more natural in Java. Besides, container doesen't need any encoding
information from .java to .jsp if non-ascii characters are converted
to the unocde escape. Why the JSP Specification doesn't mention about
UTF-8 is used internally. Is this a Tomcat specific technique ?

> If you want to tell the container what character encoding to send on a
> response, use the "contentType" attribute of the <%@ page %> directive:
> 
>   <%@ page contentType="text/html;charset=UTF-8" %>

I appreciate this function. The appropriate encoding management is that
every encodings in every phases including an input/output stream should
be controllable. 
And now, JSP pages became to be a platform independant document.

> I had to do this in my Struts demo at JavaOne Japan, for example, in
> order to display the Japanese characters correctly.  Setting pageEncoding
> would not have done this.

If the pageEncoding is not set, container applies encoding specifed in
contentType attribute, isn't it ? And, if the contentType is not set or
has no charset part, container applies ISO-8859-1 as I think UTF-8 
should be applied. UTF-8 is the most suitable encoding for a default,
because it is a language independent encoding.

---
Yoko Kamei Harada, Web Studio Ne-Po-Le
http://www.netpotlet.com/

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: pageEncoding and Jasper

Posted by Bill Barker <wb...@wilshire.com>.
----- Original Message -----
From: <yo...@netpotlet.com>
To: <to...@jakarta.apache.org>
Sent: Thursday, February 07, 2002 7:26 PM
Subject: Re: pageEncoding and Jasper


> From: "Craig R. McClanahan" <cr...@apache.org>
> Subject: RE: pageEncoding and Jasper
> Date: Thu, 31 Jan 2002 06:49:39 -0800 (PST)
> Message-ID: <20...@icarus.apache.org>
>
> > On Thu, 31 Jan 2002, Kevin Jones wrote:
> >
> > > Date: Thu, 31 Jan 2002 10:37:10 -0000
> > > From: Kevin Jones <ke...@develop.com>
> > > Reply-To: Tomcat Developers List <to...@jakarta.apache.org>
> > > To: 'Tomcat Developers List' <to...@jakarta.apache.org>
> > > Subject: RE: pageEncoding and Jasper
> > >
> > > So it's only used when compiling the JSP to a servlet?
> >
> > If "it" is the pageEncoding attribute of the <%@ page %> directive, then
> > the answer is yes.
>
> Craig, the answer is "no".
I'd like to think that Craig knows what Tomcat 4.x does ;-)

> The pageEncoding attribute is used to "read" only. Servlet codes
Which is what he said, if you followed the rest of the thread.

> generated from JSP pages are written in UTF-8. You can confirm
> the encoding of generated Servlet codes by a browser (Netscape:
> View -> Character Coding) or a utf-8 enabled editor.
This is controlled by the contentType attribute of the <%@page
...%>directive

> So, the encoding for compile is UTF-8 only.
>
It is true that Jasper (in both 3.x and 4.x branches) generates (by default)
the intermediate .java file as UTF-8 (which causes big problems when you
configure the system to use Jikes :(.
> ---
> Yoko Kamei Harada, Web Studio Ne-Po-Le
> http://www.netpotlet.com/
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: pageEncoding and Jasper

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Fri, 8 Feb 2002 yoko@netpotlet.com wrote:

> Date: Fri, 08 Feb 2002 12:26:51 +0900 (JST)
> From: yoko@netpotlet.com
> Reply-To: Tomcat Developers List <to...@jakarta.apache.org>
> To: tomcat-dev@jakarta.apache.org
> Subject: Re: pageEncoding and Jasper
>
> From: "Craig R. McClanahan" <cr...@apache.org>
> Subject: RE: pageEncoding and Jasper
> Date: Thu, 31 Jan 2002 06:49:39 -0800 (PST)
> Message-ID: <20...@icarus.apache.org>
>
> > On Thu, 31 Jan 2002, Kevin Jones wrote:
> >
> > > Date: Thu, 31 Jan 2002 10:37:10 -0000
> > > From: Kevin Jones <ke...@develop.com>
> > > Reply-To: Tomcat Developers List <to...@jakarta.apache.org>
> > > To: 'Tomcat Developers List' <to...@jakarta.apache.org>
> > > Subject: RE: pageEncoding and Jasper
> > >
> > > So it's only used when compiling the JSP to a servlet?
> >
> > If "it" is the pageEncoding attribute of the <%@ page %> directive, then
> > the answer is yes.
>
> Craig, the answer is "no".

Well, that's not the answer given by the JSP Specification ;-).

In the JSP 1.2 spec, see section 2.10.1, Table JSP.2-1, bottom of page 52,
where the "pageEncoding" attribute is defined:

  Defines the character encoding of the JSP page.

There is further text in Chapter 3 making it clear that this affects the
compiler only.  It has zero impact on what is sent to a browser as part of
an HTTP response.

> The pageEncoding attribute is used to "read" only.

Technically this is true, but remember that the source of the JSP page is
read only once, by the JSP compiler, so the answer to "it's only used when
compiling the JSP to a servlet" is correct.

> Servlet codes
> generated from JSP pages are written in UTF-8. You can confirm
> the encoding of generated Servlet codes by a browser (Netscape:
> View -> Character Coding) or a utf-8 enabled editor.
> So, the encoding for compile is UTF-8 only.
>

If you want to tell the container what character encoding to send on a
response, use the "contentType" attribute of the <%@ page %> directive:

  <%@ page contentType="text/html;charset=UTF-8" %>

I had to do this in my Struts demo at JavaOne Japan, for example, in
order to display the Japanese characters correctly.  Setting pageEncoding
would not have done this.

> ---
> Yoko Kamei Harada, Web Studio Ne-Po-Le
> http://www.netpotlet.com/
>

Craig


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: pageEncoding and Jasper

Posted by yo...@netpotlet.com.
From: "Craig R. McClanahan" <cr...@apache.org>
Subject: RE: pageEncoding and Jasper
Date: Thu, 31 Jan 2002 06:49:39 -0800 (PST)
Message-ID: <20...@icarus.apache.org>

> On Thu, 31 Jan 2002, Kevin Jones wrote:
> 
> > Date: Thu, 31 Jan 2002 10:37:10 -0000
> > From: Kevin Jones <ke...@develop.com>
> > Reply-To: Tomcat Developers List <to...@jakarta.apache.org>
> > To: 'Tomcat Developers List' <to...@jakarta.apache.org>
> > Subject: RE: pageEncoding and Jasper
> >
> > So it's only used when compiling the JSP to a servlet?
> 
> If "it" is the pageEncoding attribute of the <%@ page %> directive, then
> the answer is yes.

Craig, the answer is "no".
The pageEncoding attribute is used to "read" only. Servlet codes
generated from JSP pages are written in UTF-8. You can confirm
the encoding of generated Servlet codes by a browser (Netscape: 
View -> Character Coding) or a utf-8 enabled editor.
So, the encoding for compile is UTF-8 only.

---
Yoko Kamei Harada, Web Studio Ne-Po-Le
http://www.netpotlet.com/

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: pageEncoding and Jasper

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Thu, 31 Jan 2002, Kevin Jones wrote:

> Date: Thu, 31 Jan 2002 10:37:10 -0000
> From: Kevin Jones <ke...@develop.com>
> Reply-To: Tomcat Developers List <to...@jakarta.apache.org>
> To: 'Tomcat Developers List' <to...@jakarta.apache.org>
> Subject: RE: pageEncoding and Jasper
>
> So it's only used when compiling the JSP to a servlet?
>

If "it" is the pageEncoding attribute of the <%@ page %> directive, then
the answer is yes.

Details of how the content type (and character encoding) of the output
response are determined are in the spec section that I quoted yesterday.

Craig


> Kevin Jones
> Developmentor
> www.develop.com
>
> > -----Original Message-----
> > From: Bill Barker [mailto:wbarker@wilshire.com]
> > Sent: 30 January 2002 21:07
> > To: Tomcat Developers List
> > Subject: Re: pageEncoding and Jasper
> >
> >
> >
> > ----- Original Message -----
> > From: "Kevin Jones" <ke...@develop.com>
> > To: "'Tomcat Developers List'" <to...@jakarta.apache.org>
> > Sent: Wednesday, January 30, 2002 11:55 AM
> > Subject: RE: pageEncoding and Jasper
> >
> >
> > > > pageEncoding should be the encoding of the file
> > containing the page,
> > > > should not it?
> > >
> > > I assumed that the encoding would be set as part of the
> > content-type
> > > header in the generated servlet, but I can't see the value
> > anywhere in
> > > the servlet code.
> > Your assumtion is wrong.  The pageEncoding is only used to
> > set the encoding on the Reader when the jsp page is compiled.
> >  See section 3.1 of the JSP spec.
> > >
> > > > >do  anything. I can't use
> > > > >
> > > > > <%@ page contentType="text/html; charset=windows-1256" %>
> > > > >
> > > >
> > > > Why?
> > >
> > > Because IE hates it (although being fair that seems to be a
> > limitation
> > > of IE)
> > >
> > > Kevin Jones
> > > Developmentor
> > > www.develop.com
> > >
> > > > -----Original Message-----
> > > > From: jfclere@vtxrm2.bcn.fsc.net
> > [mailto:jfclere@vtxrm2.bcn.fsc.net]
> > > > On Behalf Of jean-frederic clere
> > > > Sent: 30 January 2002 18:00
> > > > To: Tomcat Developers List
> > > > Subject: Re: pageEncoding and Jasper
> > > >
> > > >
> > > > Kevin Jones wrote:
> > > > >
> > > > > If I add a
> > > > >
> > > > > <%@ page pageEncoding="windows-1256" %>
> > > > >
> > > > > (or any pageEncoding)
> > > > >
> > > > > What does Jasper do with this? I would expect this to be set on
> > > > > the content-type header but it's not.
> > > >
> > > >
> > > > >Jasper certainly parses the parameter
> > > > > and fails if I put an invalid value in there, I just can't
> > > > get it to
> > > >
> > > > > I have to use
> > > > >
> > > > > <META HTTP-EQUIV="content-type" CONTENT="text/html;
> > > > > charset=windows-1256">
> > > > >
> > > > > Some of this might seem like a user question, but I'm more
> > > > concerned
> > > > > about how Jasper works and what it should be doing.
> > > > >
> > > > > Thanks,
> > > > >
> > > > > Kevin Jones
> > > > > Developmentor
> > > > > www.develop.com
> > > > >
> > > > > --
> > > > > To unsubscribe, e-mail:
> > > > <mailto:tomcat-dev-> unsubscribe@jakarta.apache.org>
> > > > > For
> > > > additional commands,
> > > > e-mail:
> > > > > <ma...@jakarta.apache.org>
> > > >
> > > > --
> > > > To unsubscribe, e-mail:
> > > > <mailto:tomcat-dev-> unsubscribe@jakarta.apache.org>
> > > > For
> > > > additional commands,
> > > > e-mail: <ma...@jakarta.apache.org>
> > > >
> > >
> > >
> > > --
> > > To unsubscribe, e-mail:
> > <ma...@jakarta.apache.org>
> > > For additional commands, e-mail:
> > <ma...@jakarta.apache.org>
> > >
> >
> >
> > --
> > To unsubscribe, e-mail:
> > <mailto:tomcat-dev-> unsubscribe@jakarta.apache.org>
> > For
> > additional commands,
> > e-mail: <ma...@jakarta.apache.org>
> >
>
>
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: pageEncoding and Jasper

Posted by Kevin Jones <ke...@develop.com>.
So it's only used when compiling the JSP to a servlet?

Kevin Jones
Developmentor
www.develop.com 

> -----Original Message-----
> From: Bill Barker [mailto:wbarker@wilshire.com] 
> Sent: 30 January 2002 21:07
> To: Tomcat Developers List
> Subject: Re: pageEncoding and Jasper
> 
> 
> 
> ----- Original Message -----
> From: "Kevin Jones" <ke...@develop.com>
> To: "'Tomcat Developers List'" <to...@jakarta.apache.org>
> Sent: Wednesday, January 30, 2002 11:55 AM
> Subject: RE: pageEncoding and Jasper
> 
> 
> > > pageEncoding should be the encoding of the file 
> containing the page, 
> > > should not it?
> >
> > I assumed that the encoding would be set as part of the 
> content-type 
> > header in the generated servlet, but I can't see the value 
> anywhere in 
> > the servlet code.
> Your assumtion is wrong.  The pageEncoding is only used to 
> set the encoding on the Reader when the jsp page is compiled. 
>  See section 3.1 of the JSP spec.
> >
> > > >do  anything. I can't use
> > > >
> > > > <%@ page contentType="text/html; charset=windows-1256" %>
> > > >
> > >
> > > Why?
> >
> > Because IE hates it (although being fair that seems to be a 
> limitation 
> > of IE)
> >
> > Kevin Jones
> > Developmentor
> > www.develop.com
> >
> > > -----Original Message-----
> > > From: jfclere@vtxrm2.bcn.fsc.net 
> [mailto:jfclere@vtxrm2.bcn.fsc.net] 
> > > On Behalf Of jean-frederic clere
> > > Sent: 30 January 2002 18:00
> > > To: Tomcat Developers List
> > > Subject: Re: pageEncoding and Jasper
> > >
> > >
> > > Kevin Jones wrote:
> > > >
> > > > If I add a
> > > >
> > > > <%@ page pageEncoding="windows-1256" %>
> > > >
> > > > (or any pageEncoding)
> > > >
> > > > What does Jasper do with this? I would expect this to be set on 
> > > > the content-type header but it's not.
> > >
> > >
> > > >Jasper certainly parses the parameter
> > > > and fails if I put an invalid value in there, I just can't
> > > get it to
> > >
> > > > I have to use
> > > >
> > > > <META HTTP-EQUIV="content-type" CONTENT="text/html; 
> > > > charset=windows-1256">
> > > >
> > > > Some of this might seem like a user question, but I'm more
> > > concerned
> > > > about how Jasper works and what it should be doing.
> > > >
> > > > Thanks,
> > > >
> > > > Kevin Jones
> > > > Developmentor
> > > > www.develop.com
> > > >
> > > > --
> > > > To unsubscribe, e-mail:
> > > <mailto:tomcat-dev-> unsubscribe@jakarta.apache.org>
> > > > For
> > > additional commands,
> > > e-mail:
> > > > <ma...@jakarta.apache.org>
> > >
> > > --
> > > To unsubscribe, e-mail:
> > > <mailto:tomcat-dev-> unsubscribe@jakarta.apache.org>
> > > For
> > > additional commands,
> > > e-mail: <ma...@jakarta.apache.org>
> > >
> >
> >
> > --
> > To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> > For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> >
> 
> 
> --
> To unsubscribe, e-mail:   
> <mailto:tomcat-dev-> unsubscribe@jakarta.apache.org>
> For 
> additional commands, 
> e-mail: <ma...@jakarta.apache.org>
> 


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: pageEncoding and Jasper

Posted by Bill Barker <wb...@wilshire.com>.
----- Original Message -----
From: "Kevin Jones" <ke...@develop.com>
To: "'Tomcat Developers List'" <to...@jakarta.apache.org>
Sent: Wednesday, January 30, 2002 11:55 AM
Subject: RE: pageEncoding and Jasper


> > pageEncoding should be the encoding of the file containing
> > the page, should not it?
>
> I assumed that the encoding would be set as part of the content-type
> header in the generated servlet, but I can't see the value anywhere in
> the servlet code.
Your assumtion is wrong.  The pageEncoding is only used to set the encoding
on the Reader when the jsp page is compiled.  See section 3.1 of the JSP
spec.
>
> > >do  anything. I can't use
> > >
> > > <%@ page contentType="text/html; charset=windows-1256" %>
> > >
> >
> > Why?
>
> Because IE hates it (although being fair that seems to be a limitation
> of IE)
>
> Kevin Jones
> Developmentor
> www.develop.com
>
> > -----Original Message-----
> > From: jfclere@vtxrm2.bcn.fsc.net
> > [mailto:jfclere@vtxrm2.bcn.fsc.net] On Behalf Of jean-frederic clere
> > Sent: 30 January 2002 18:00
> > To: Tomcat Developers List
> > Subject: Re: pageEncoding and Jasper
> >
> >
> > Kevin Jones wrote:
> > >
> > > If I add a
> > >
> > > <%@ page pageEncoding="windows-1256" %>
> > >
> > > (or any pageEncoding)
> > >
> > > What does Jasper do with this? I would expect this to be set on the
> > > content-type header but it's not.
> >
> >
> > >Jasper certainly parses the parameter
> > > and fails if I put an invalid value in there, I just can't
> > get it to
> >
> > > I have to use
> > >
> > > <META HTTP-EQUIV="content-type" CONTENT="text/html;
> > > charset=windows-1256">
> > >
> > > Some of this might seem like a user question, but I'm more
> > concerned
> > > about how Jasper works and what it should be doing.
> > >
> > > Thanks,
> > >
> > > Kevin Jones
> > > Developmentor
> > > www.develop.com
> > >
> > > --
> > > To unsubscribe, e-mail:
> > <mailto:tomcat-dev-> unsubscribe@jakarta.apache.org>
> > > For
> > additional commands,
> > e-mail:
> > > <ma...@jakarta.apache.org>
> >
> > --
> > To unsubscribe, e-mail:
> > <mailto:tomcat-dev-> unsubscribe@jakarta.apache.org>
> > For
> > additional commands,
> > e-mail: <ma...@jakarta.apache.org>
> >
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: pageEncoding and Jasper

Posted by Kevin Jones <ke...@develop.com>.
> pageEncoding should be the encoding of the file containing 
> the page, should not it?

I assumed that the encoding would be set as part of the content-type
header in the generated servlet, but I can't see the value anywhere in
the servlet code.

> >do  anything. I can't use
> > 
> > <%@ page contentType="text/html; charset=windows-1256" %>
> > 
> 
> Why?

Because IE hates it (although being fair that seems to be a limitation
of IE)

Kevin Jones
Developmentor
www.develop.com 

> -----Original Message-----
> From: jfclere@vtxrm2.bcn.fsc.net 
> [mailto:jfclere@vtxrm2.bcn.fsc.net] On Behalf Of jean-frederic clere
> Sent: 30 January 2002 18:00
> To: Tomcat Developers List
> Subject: Re: pageEncoding and Jasper
> 
> 
> Kevin Jones wrote:
> > 
> > If I add a
> > 
> > <%@ page pageEncoding="windows-1256" %>
> > 
> > (or any pageEncoding)
> > 
> > What does Jasper do with this? I would expect this to be set on the 
> > content-type header but it's not.
> 
> 
> >Jasper certainly parses the parameter
> > and fails if I put an invalid value in there, I just can't 
> get it to 
> 
> > I have to use
> > 
> > <META HTTP-EQUIV="content-type" CONTENT="text/html; 
> > charset=windows-1256">
> > 
> > Some of this might seem like a user question, but I'm more 
> concerned 
> > about how Jasper works and what it should be doing.
> > 
> > Thanks,
> > 
> > Kevin Jones
> > Developmentor
> > www.develop.com
> > 
> > --
> > To unsubscribe, e-mail:   
> <mailto:tomcat-dev-> unsubscribe@jakarta.apache.org>
> > For 
> additional commands, 
> e-mail: 
> > <ma...@jakarta.apache.org>
> 
> --
> To unsubscribe, e-mail:   
> <mailto:tomcat-dev-> unsubscribe@jakarta.apache.org>
> For 
> additional commands, 
> e-mail: <ma...@jakarta.apache.org>
> 


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: pageEncoding and Jasper

Posted by jean-frederic clere <jf...@fujitsu-siemens.com>.
Kevin Jones wrote:
> 
> If I add a
> 
> <%@ page pageEncoding="windows-1256" %>
> 
> (or any pageEncoding)
> 
> What does Jasper do with this? I would expect this to be set on the
> content-type header but it's not. 

pageEncoding should be the encoding of the file containing the page, should not
it?

>Jasper certainly parses the parameter
> and fails if I put an invalid value in there, I just can't get it to do
> anything. I can't use
> 
> <%@ page contentType="text/html; charset=windows-1256" %>
> 

Why?

> I have to use
> 
> <META HTTP-EQUIV="content-type" CONTENT="text/html;
> charset=windows-1256">
> 
> Some of this might seem like a user question, but I'm more concerned
> about how Jasper works and what it should be doing.
> 
> Thanks,
> 
> Kevin Jones
> Developmentor
> www.develop.com
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: pageEncoding and Jasper

Posted by Kevin Jones <ke...@develop.com>.
2.10.1 says

"Defines the character encoding for the JSP page.
Values is of the form "CHARSET" which must be the IANA
value for a character encoding.
The CHARSET value of contentType is used as default if
present, or ISO-8859-1 otherwise."

What I was missing was how this is processed by the page compiler - I
think I understand now!

Kevin Jones
Developmentor
www.develop.com 

> -----Original Message-----
> From: Craig R. McClanahan [mailto:craigmcc@apache.org] 
> Sent: 30 January 2002 21:09
> To: Tomcat Developers List
> Subject: Re: pageEncoding and Jasper
> 
> 
> The rules that cover this stuff are in the JSP 1.2 Spec, 
> Section 2.10.1.
> 
> On Wed, 30 Jan 2002, Kevin Jones wrote:
> 
> > Date: Wed, 30 Jan 2002 17:41:48 -0000
> > From: Kevin Jones <ke...@develop.com>
> > Reply-To: Tomcat Developers List <to...@jakarta.apache.org>
> > To: Tomcat-Dev <to...@jakarta.apache.org>
> > Subject: pageEncoding and Jasper
> >
> > If I add a
> >
> > <%@ page pageEncoding="windows-1256" %>
> >
> > (or any pageEncoding)
> >
> > What does Jasper do with this? I would expect this to be set on the 
> > content-type header but it's not. Jasper certainly parses the 
> > parameter and fails if I put an invalid value in there, I 
> just can't 
> > get it to do anything. I can't use
> >
> 
> The "pageEncoding" attribute specifies the encoding to be 
> used to *read* the page itself at compile time.
> 
> 
> > <%@ page contentType="text/html; charset=windows-1256" %>
> >
> 
> This is supposed to set the content type and character 
> encoding on the response page, as long as "windows-1256" is a 
> valid character set for your JDK.  It works for me with a 
> page in the Struts example app (HEAD branch) that starts:
> 
>   <%@ page contentType="text/html;charset=UTF-8" language="java" %>
> 
> and the generated servlet code has the following line near 
> the beginning:
> 
>   response.setContentType("text/html;charset=UTF-8");
> 
> > I have to use
> >
> > <META HTTP-EQUIV="content-type" CONTENT="text/html; 
> > charset=windows-1256">
> >
> > Some of this might seem like a user question, but I'm more 
> concerned 
> > about how Jasper works and what it should be doing.
> >
> 
> AFAICT, Jasper is doing the right thing.  Whether IE properly 
> deals with a character encoding attached to the content type 
> like this (as the HTTP spec requires) is another question entirely.
> 
> > Thanks,
> >
> > Kevin Jones
> > Developmentor
> > www.develop.com
> >
> 
> Craig McClanahan
> 
> 
> 
> --
> To unsubscribe, e-mail:   
> <mailto:tomcat-dev-> unsubscribe@jakarta.apache.org>
> For 
> additional commands, 
> e-mail: <ma...@jakarta.apache.org>
> 


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: pageEncoding and Jasper

Posted by "Craig R. McClanahan" <cr...@apache.org>.
The rules that cover this stuff are in the JSP 1.2 Spec, Section 2.10.1.

On Wed, 30 Jan 2002, Kevin Jones wrote:

> Date: Wed, 30 Jan 2002 17:41:48 -0000
> From: Kevin Jones <ke...@develop.com>
> Reply-To: Tomcat Developers List <to...@jakarta.apache.org>
> To: Tomcat-Dev <to...@jakarta.apache.org>
> Subject: pageEncoding and Jasper
>
> If I add a
>
> <%@ page pageEncoding="windows-1256" %>
>
> (or any pageEncoding)
>
> What does Jasper do with this? I would expect this to be set on the
> content-type header but it's not. Jasper certainly parses the parameter
> and fails if I put an invalid value in there, I just can't get it to do
> anything. I can't use
>

The "pageEncoding" attribute specifies the encoding to be used to *read*
the page itself at compile time.


> <%@ page contentType="text/html; charset=windows-1256" %>
>

This is supposed to set the content type and character encoding on the
response page, as long as "windows-1256" is a valid character
set for your JDK.  It works for me with a page in the Struts example app
(HEAD branch) that starts:

  <%@ page contentType="text/html;charset=UTF-8" language="java" %>

and the generated servlet code has the following line near the beginning:

  response.setContentType("text/html;charset=UTF-8");

> I have to use
>
> <META HTTP-EQUIV="content-type" CONTENT="text/html;
> charset=windows-1256">
>
> Some of this might seem like a user question, but I'm more concerned
> about how Jasper works and what it should be doing.
>

AFAICT, Jasper is doing the right thing.  Whether IE properly deals with a
character encoding attached to the content type like this (as the HTTP
spec requires) is another question entirely.

> Thanks,
>
> Kevin Jones
> Developmentor
> www.develop.com
>

Craig McClanahan



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>