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 20161 - MOD: I18N - There should be a default file encoding per web module
Summary: MOD: I18N - There should be a default file encoding per web module
Status: VERIFIED FIXED
Alias: None
Product: javaee
Classification: Unclassified
Component: Code (show other bugs)
Version: -FFJ-
Hardware: All All
: P2 blocker with 1 vote (vote)
Assignee: Petr Pisl
URL:
Keywords: I18N
Depends on:
Blocks:
 
Reported: 2002-02-05 14:01 UTC by Petr Jiricka
Modified: 2008-06-18 16:28 UTC (History)
1 user (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Petr Jiricka 2002-02-05 14:01:06 UTC
Currently file encoding can be specified separately for each JSP page. It would 
be useful to have a default setting on the Web Module level.
Comment 1 _ rkubacki 2002-02-08 13:21:15 UTC
Is it enough to add module settings property and change 
handleCreateFromTemplate of JspDataObject.
Comment 2 Marek Grummich 2002-07-22 12:15:36 UTC
Set target milestone to TBD
Comment 3 Marek Grummich 2002-07-22 12:26:46 UTC
Set target milestone to TBD
Comment 4 Jesse Glick 2002-12-23 16:37:42 UTC
Consistent use of the I18N keyword.
Comment 5 Petr Jiricka 2003-07-14 09:35:16 UTC
Given the proposed solution for issue 7427, this issue now takes on a
slightly different meaning. What might make sense is if there was an
encoding property at the project (web module) level, which would
control the encoding of newly created pages.
Comment 6 Petr Jiricka 2003-12-05 10:22:14 UTC
Reassigning to Petr Pisl. Will not be addressed for NetBeans 3.6.
Comment 7 Petr Pisl 2003-12-05 13:29:47 UTC
I think this could be solved via deployment descriptor.

We can add into the deployment descriptor for the new web module
<jsp-property-group>
    <url-pattern>*.jsp</url-pattern>
    <page-encoding>UTF-8</page-encoding>
</jsp-property-group>

and then all the jsp files will be in UTF-8 encoding by default.
Comment 8 Ana.von Klopp 2003-12-05 21:30:21 UTC
Note that the encoding that is set in the page directive or in the jsp 
property group in the deployment descriptor applies to the *page* 
encoding. This encoding is used for the HTTP response only if the 
response encoding has not been set separately. 

The page encoding is specifically for tools, and need not be the same 
as the response encoding. If for example the developers use a visual 
editor for JSPs, it's likely that they need to use the page encoding 
that this tool likes. 

If you're using the IDE, chances are that you don't care that much 
about the page encoding. We can pretty much set it to UTF-8 across the 
board as an initial value and that will be OK for our editor. 

Usually the issue that the developer has when they want to response to 
show correctly is setting the response encoding. This is what we 
should encourage our users to do when they're developing 
internationalized applications. If your web app is targetting regular 
browsers (that is, not PDAs or cellphones) then the best approach is 
to set the response encoding to UTF-8. If you do target those devices, 
you typically need to set the encoding on a per device basis (the 2.4 
DD allow you to set the response encoding on a per language basis, but 
that's not that useful). 

Please refer to Norbert Lindenberg's write up for more about encoding: 
 http://java.sun.
com/developer/technicalArticles//Intl/MultilingualJSP/

My recommendation is to close this issue and do the following: 
- include the page encoding directive in the JSPs, default to UTF-8
- include sample code that sets the response encoding in the servlet
  sample code, with a comment that explains why we do it. 

If you use JSF, it will try to set the response encoding for you. I 
don't know whether Struts does. 

Comment 9 Petr Jiricka 2004-02-16 18:28:47 UTC
> - include the page encoding directive in the JSPs, default to UTF-8

Ana, so you basically think that it's not necessary to have a
per-webmodule setting for file encoding nor response encoding, it's
just enough to set UTF-8 for file encoding in each page and that's it?

Ken, you recently mentioned this issue in a related conversation -
what do you think?
Comment 10 zikmund 2005-05-03 15:59:55 UTC
Implemented in 4.1 (both Ana's suggestions).
Comment 11 kaa 2008-06-18 16:28:41 UTC
Now JSP files use project encoding value by default. (build 20080614)