This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 40791 - I18N - Wrong encoding is used for opening and saving jsp pages.
Summary: I18N - Wrong encoding is used for opening and saving jsp pages.
Status: VERIFIED FIXED
Alias: None
Product: javaee
Classification: Unclassified
Component: JSP (show other bugs)
Version: 3.x
Hardware: PC Linux
: P3 blocker (vote)
Assignee: Petr Pisl
URL:
Keywords: I18N, TOMCAT
Depends on:
Blocks: 44422
  Show dependency tree
 
Reported: 2004-03-05 12:14 UTC by Petr Pisl
Modified: 2005-03-31 18:09 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Petr Pisl 2004-03-05 12:14:26 UTC
When a jsp page has defined encoding in charset
value and in pageEncoding attribute and these
encodings are different, then the file is open and
saved with encoding from charset. According to the
JSP 2.0 specification the pageEncoding has to be
used for saving and opening pages.
Comment 1 Petr Pisl 2004-03-05 12:17:55 UTC
This is bug in tomcat's parser. Maybe is connected with issue #38251.
Comment 2 Ken Frank 2004-03-05 16:43:14 UTC
making P2 as encoding issue which is important.
Comment 3 Keiichi Oono 2004-03-05 16:54:43 UTC
case:
  - create web module
  - edit web.xml
    add <page-encoding> element to specify
    encoding (e.g. EUC-JP), save and close
  - create JSP

JSP is generated as follows:
------
<@page contentType="text/html; charset=EUC-JP"%>
<@page pageEncoding="UTF-8"%>
<html>...
------

In this case, it means;
  response character encoding is EUC-JP
  pageEncoding is UTF-8
  value of <page-encoding> element is EUC-JP

I understand charset attribute can be different from pageEncoding,
it's in issue #40780, But I don't think pageEncoding can be different
from the value of <page-encoding> element, because the above example
cause org.apache.jsper.JasperException in my environment. Tomcat's
translated error message is corrupted in my NS7, but it seems to
report mismatch of EUC-JP and UTF-8.

In this case, here is what I'm thinking:
  -  <page-encoding> has been set by the user (EUC-JP)
  -  I think pageEncoding needs to be same as <page-encoding>, but set
     as UTF-8
  -  charset attribute can be different, but it needs to be set
     same value (EUC-JP) because of bug in tomcat's parser.

Would you give me your comments?
Comment 4 Petr Jiricka 2004-03-05 18:36:08 UTC
Petr, so do we have a Tomcat bug number that we can use for tracking
this? If not, can you file one? Thanks.
Comment 5 Petr Pisl 2004-03-08 15:24:08 UTC
I filled new bug against tomcat:
http://issues.apache.org/bugzilla/show_bug.cgi?id=27517
Comment 6 Petr Pisl 2004-03-08 19:01:33 UTC
I did small fix. This fix remove including the charset into jsp file
during creating file from template. As result of this fix, the jsp
file will not have defined charset after creating. The issue in tomcat
is still here, so if somebody add the charset with different encoding
as encoding in the pageEncoding, then the opening and saving file will
not be in correct encoding.

The fix is:
http://web.netbeans.org/source/browse/web/core/src/org/netbeans/modules/web/core/jsploader/JspDataObject.java.diff?r1=1.45&r2=1.46
Comment 7 Martin Schovanek 2004-03-09 11:11:21 UTC
Reviewed by QE in the trunk build #200403081900. The fix looks fine.
Comment 8 Martin Grebac 2004-03-10 13:39:55 UTC
Reviewed. Fix looks fine.
Comment 9 Petr Pisl 2004-03-10 15:18:39 UTC
So the partial fix is now in the 3.6 branch. I think, now we can
downgrade the priority to P3 and wait for the new tomcat.
Comment 10 Petr Pisl 2004-06-29 14:29:41 UTC
The bug was fixed in the Tomcat. So now it works in the ide as well.
Comment 11 Ken Frank 2005-03-31 18:09:07 UTC
verfied as per comments in this report.