tomcat-dev mailing list archives

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

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
JasperException(Constants.getString("jsp.error.include.missing.file"));

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

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" -
Parser:

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

---
Damian Golda

Damian@iif.pl


-----Original Message-----
From: tomcat-dev-return-7905-damian=iif.pl@jakarta.apache.org
[mailto:tomcat-dev-return-7905-damian=iif.pl@jakarta.apache.org]On Behalf Of
Pilho Kim
Sent: Monday, January 01, 1601 1:00 AM
To: tomcat-dev@jakarta.apache.org
Subject: include and multi-byte characters


Hi,

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?

Thanks


Mime
View raw message