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.
1. Create new Maven Web Application Project 2. Create new jsp tag file (would go to WEB-INF/tags directory) 3. Open it in the editor, rightclick and select properties to make sure it has encoding "UTF-8" 4. Open pom.xml file and change project type (packaging tag value) to "bundle" 5. Close tag file and open it again in the editor (important - just selecting its properties in the project tree will not work) Result: See that now it has encoding "ISO-8859-1" and if it had some non-latin characters inside, they woul be displayed incorrectly in the editor. Expected result: Encoding for tag files should remain UTF-8 with any project type. This magically happens only with jsp tag files - other jsp and java files are not affected. Changing project type back to "war" brings back the right UTF-8 encoding.
reassigning to javaee. Having files not respecting the project's encoding settings sounds like a bug in the jsp dataloader (or whereever the encoding is set)
Actually, the IDE has to honor the encoding that will be used at runtime. The JSP spec clearly says how to determine the encoding, and the server needs to honor that. The IDE must use the same algorithm as the server. By default, JSP encoding is ISO-8859-1 if not overriden, which is the reason why a JSP page created from template in NetBeans overrides this default: <%@page contentType="text/html" pageEncoding="UTF-8"%> The JSP specification of course specifies the algorithm to determine the encoding in the context of a war file, which is the standard packaging format for web applications. It takes into account web.xml etc. Now we are dealing with a non-standard packaging format (OSGi bundle - see also discussion in bug 179584), so how do we determine the encoding if it is not specified? How does the server do it? Regarding your tag file, does it specify the pageEncoding attribute in the page directive?
I have made some experiments with jsp and tag files. Both normal jsp and jsp tag have "pageEncoding="UTF-8"" in the header (which is added by default): <%@tag description="put the tag description here" pageEncoding="UTF-8"%> 1. For war project + pageEncoding="UTF-8" in the header: - .jsp file has UTF-8 encoding - .tag file has UTF-8 encoding 2. For bundle project + pageEncoding="UTF-8" in the header: - .jsp file has UTF-8 encoding - .tag file has ISO-8859-1 encoding 3. For war project + pageEncoding not set in the header: - .jsp file has ISO-8859-1 encoding - .tag file has ISO-8859-1 encoding 4. For bundle project + pageEncoding not set in the header: - .jsp file has ISO-8859-1 encoding - .tag file has ISO-8859-1 encoding So, for jsp files pageEncoding value is respected with no dependance to project type, for tag files it is respected only for war projects.
Thanks for investigating. Assigning to Tomasz.
Created attachment 101710 [details] Screenshot of ignored encoding set in tag file
I have just hit this bug (?) too. I'm using the JAR project type and for love nor money does Netbeans open my tag files in UTF-8. I have set the -J-Dfile.encoding=UTF-8 flag in netbeans.conf, the project's encoding is set to UTF-8, too, and the tag file has both an XML doctype and a pageEncoding directive both specifying UTF-8 as the encoding. I would love to create a path and I'm currently checking out the sources. Judging from the download time, the project is vast and I would appreciate any pointers of where to look. Thanks.
> I would love to create a path and I'm currently checking out the sources. *patch* not path.
Same thing even with WAR (8.0.1)
I found a new way to reproduce this encoding detection problem. Have a jsp file encoded in UTF-8 and simply change the file extension to jspf. Instantly it becomes treated as a ISO-8859-1 and all non-ascii symbols become unreadable. Adding -J-Dfile.encoding=UTF-8 to the launch options did not help.