seiji takegata wrote:
Hi,

I'm trying to generate PDF document from JSP, using itext library.
(http://www.lowagie.com/iText/)


I set contentType attribute to get browser open AdobeReader, and
pageEncoding to get right encoding for Japanese characters,

<%@ page contentType="application/pdf" pageEncoding="Shift_JIS" %>

Jasper translates this line to;

response.setContentType("application/pdf;charset=Shift_JIS");

I want to set response type to look like PDF without any particular encoding, and to tell Jasper that my source encoded with "Shift_JIS", because IE does not recognize the contentType if charset option is added.

My question is:
1. Why Jasper adds charset option when I specify pageEncoding attribute?
2. Can I make Jasper not to add charset option when I use pageEncoding?

I posted same question to tomcat-user ML, then I was suggested to post this question to tomcat-dev list.

This is my first message to this list.

Notice that this is consistent with the JSP 2.0 spec (see JSP.4.2: "Response Character Encoding"):

The initial response char encoding is set to the CHARSET value of
the contentType attribute of the page directive. If the page doesn't
provide this attribute or the attribute does not have a CHARSET value
[as in your case], the initial response char encoding is determined as
follows:
* ...
* For JSP pages in standard syntax, it is the character encoding specified
by the pageEncoding attribute of the page directive ...


The reason behind this is that if the page specifies a page
character encoding (other than ISO-8859-1), it probably contains
non-Latin characters that may get lost if the response switched to
another char encoding.

If this is not what you want, you should consider using XML syntax for
your JSPs, in which case the response char encoding is set to UTF-8
(under the above circumstances), regardless of the autodetected page
source encoding.


Jan





Thanks you.
--
seiji takegata
[EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to