Pierre Delisle is wondering:
> -----
> Bug #55
> 
>    -----
>    Synopsis: 
>      Default for included files is 8859_1, with no option to 
> set otherwise. 
>   [SNIP]
> I'm not sure I fully understand what's described there,
> so here is what I believe should be done. 
> 
> The "encoding" for a JSP file is currently handled as follows:
> 
> 1. In Compiler.java, we create a JspReader for the top-level
>    ("including") jsp file using the 8859_1 encoding.
> 
> 2. Using that JspReader, we check if there is a page directive
>    with 'contentType' specified. If there is, then 
>    a new JspReader for the page is created with the encoding 
> set to the 
>    "charset" specified in the contentType value of the page
>    directive; otherwise we stick with the default 8859_1 encoding.
> 
> 3. When a page is included, JspReader.pushFile() is called,
>    and the encoding passed as argument appears to always 
>    be null (since no encoding attribute can be specified in 
>    the "include" directive, reading 'encoding' off of the 
>    attributes appears to be a bug in JspParseEventListener).
>    Because it is null, it always defaults to 8859_1. 
> 
> If I understand well the intent of the bug report, we'd need the 
> following modifications:
> 
> - In step 2, if contentType is not specified in the "including" page,
>   set the encoding to be:
> 
>      encoding = System.getProperty("file.encoding", "8859_1");
> 
>   This means that the default encoding of all JSP files at a 
> site could
>   be defined globally using system property "file.encoding".
>   I don't think this is spec-compliant, and would be reluctant
>   to make that change. 
> 
> - In step 3, use the encoding of the "including" page.
> 
>   This would fix what I believe is a bug in the current 
> implementation.
> 
> 
> Comments?

Maybe I'm not reading carefully enough (and I haven't had time to trace the
code) but I don't understand what you mean in your "modifications".

The correct behavior seems to me that when a file is included, a 'fake'
JspReader should be created to scan the file for a @page directive with a
contentType, then create the 'real' JspReader using either the @page
directive if it was found, or the encoding of the including file as a
default.

You may be already saying what I just said, and I hope you are :-)  Hans'
replies have confused me(!), because they don't really seem to apply to this
bug.

Hope this helps,
Brian
-------------------------
Brian Bucknam
WebGain, Inc.
[EMAIL PROTECTED]

Reply via email to