On Fri, 8 Feb 2002 [EMAIL PROTECTED] wrote:
> Date: Fri, 08 Feb 2002 12:26:51 +0900 (JST)
> From: [EMAIL PROTECTED]
> Reply-To: Tomcat Developers List <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Subject: Re: pageEncoding and Jasper
>
> From: "Craig R. McClanahan" <[EMAIL PROTECTED]>
> Subject: RE: pageEncoding and Jasper
> Date: Thu, 31 Jan 2002 06:49:39 -0800 (PST)
> Message-ID: <[EMAIL PROTECTED]>
>
> > On Thu, 31 Jan 2002, Kevin Jones wrote:
> >
> > > Date: Thu, 31 Jan 2002 10:37:10 -0000
> > > From: Kevin Jones <[EMAIL PROTECTED]>
> > > Reply-To: Tomcat Developers List <[EMAIL PROTECTED]>
> > > To: 'Tomcat Developers List' <[EMAIL PROTECTED]>
> > > 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: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>