tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Damian Go³da <>
Subject RE: include and multi-byte characters
Date Thu, 29 Jun 2000 18:41:07 GMT

I suppose it's a bug -  I've got the same problem with ISO8859_2 encoding.

I think it's because JspParseEventListener try get attribute "encoding", but
directive "include" can have only "file" attribute.
Look at org.apache.jasper.compile.JspParseEventListener.handleDirective:
	if (directive.equals("include")) {
	    String file = (String) attrs.get("file");
	    String encoding = (String) attrs.get("encoding");

	    if (file == null)
		throw new

            // jsp.error.include.bad.file needs taking care of here??
            try {
                reader.pushFile(file, encoding);
            } catch (FileNotFoundException fnfe) {
                throw new

So encoding is always null, and null is passed to JspReader.pushFile:

private void pushFile(File file, String encoding)
	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

And finally encoding is set always to "8859_1" !!!!

You must not set encoding attribute in include directive, because Parser
raise exception. It allows only "file" -

	private static final JspUtil.ValidAttribute[] includeDvalidAttrs = {
	    new JspUtil.ValidAttribute ("file", true)

Damian Golda

-----Original Message-----
[]On Behalf Of
Pilho Kim
Sent: Monday, January 01, 1601 1:00 AM
Subject: include and multi-byte characters


It seems that <%@ include file="foo.jsp" %>
has some bug when foo.jsp contains multi-byte characters.

But <jsp:include page="foo.jsp" flush="true" /> works good
with multi-byte characters.

Is it a bug or else?


View raw message