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.
Tested in NB 6 build 200703221900 Steps to reproduce: Create project with UTF-8 encoding. Open Java Class template and put ěščřžýáí chars to it. Create new class file. Result: ěščřžýáíé is OK but __DATE__ is 23. b�ezen 2007 ( I'm using cz_cs locale) Template variables uses different than templates. B) Switch project to Windows-1250 Create new class Result: ěščřžýáíé is created as: ěščřžýáé but __DATE is corectly displayed as 23. březen 2007 I think: Templates variables use native encoding (windows 1250 on Windows) Templates itself use UTF-8 encoding When NB project use different encoding from templates, templates doesn't converted. I don't understand it. Why NB doesn't use for all internall operation unicode? Only when user load or save .java file, NB take conversion from/to unicode.
Sorry, what does this have to do with apisupport?
Sorry. I was not idea where this is. I searched for "template" in this page http://www.netbeans.org/issues/enter_bug.cgi
What the issue has to do with me? Primarily this is bug in the Java templates, I am not saying something is not wrong openide/loaders, however I need Java guys to help me understand what it is.
Related to #94676
It relates to old templates see e.g. __DATE__. Jarda fixed encoding of new tempates in ScriptingCreateFromTemplateHandler.java,v 1.3 To Jarda and Tomas: should not the template support register FileEncodingQueryImplementation to provide UTF-8 as default encoding for files located on SFS? Templates are not part of any project so UTF-8 seems to be reasonable. Nowadays default impl in DataObjectEncodingQueryImplementation returns null that is resolved as Charset.defaultCharset() by FileEncodingQuery.
To Honza: Update sources, Jarda already implemented this previous week. :-)
I have fresh sources. Jarda added FileEncodingQuery to ScriptingCreateFromTemplateHandler.java,v 1.3 as I mentioned before. That's OK. But this query returns Charset.defaultCharset() for templates. Could you point me to FileEncodingQueryImplementation instance that returns UTF-8 for templates please?
FileEncodingQuery.java (77)
Thanks for the pointer. So after integrating of issue #95399 I consider this as fixed for J2SE templates then.
Doesn't seem to work correctly on Japanese Solaris.
Please be more specific. What exactly does not work? What template, build, ...?
Current trunk, new Java file when local is jp-EUC and project encoding is UTF-8.
Partial fix, correct encoding is used also for old templates. Don't work for templates with guarded blocks (forms). Checking in src/org/netbeans/modules/java/IndentFileEntry.java; /cvs/java/source/src/org/netbeans/modules/java/IndentFileEntry.java,v <-- IndentFileEntry.java new revision: 1.3; previous revision: 1.2 done Checking in src/org/netbeans/modules/java/Util.java; /cvs/java/source/src/org/netbeans/modules/java/Util.java,v <-- Util.java new revision: 1.3; previous revision: 1.2 done
Not only old form module's templates with guarded blocks but form files should also work now. The form module was not adapted to FileEncodingQuery. /cvs/form/src/org/netbeans/modules/form/FormEditorSupport.java,v <-- FormEditorSupport.java new revision: 1.206; previous revision: 1.205 done Checking in ide/golden/deps.txt; /cvs/ide/golden/deps.txt,v <-- deps.txt new revision: 1.492; previous revision: 1.491 done Checking in form/nbproject/project.xml; /cvs/form/nbproject/project.xml,v <-- project.xml new revision: 1.39; previous revision: 1.38
The fix of FormEditorSupport is not correct event it will probably work for form files. The problem is that the GuardedSectionsProvider is an public SPI and correct .implementation for JSP or XML may be impossible.
OK, the API problems with guarded reader does not affect any existing code. So Honza will solve it in separate issue. Closing as fixed, both old and new java templates, including forms, work fine.
I confirm it. Encoding problems are gone. But it's interesting, that template for Class file use differen format now and when I have my own template with old style, it doesn't work. But for example JPanel or Jform template use also old style templates and works.
based on tprochazka comments, will mark as verified. ken.frank@sun.com