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 138973

Summary: I18N - Encoding of DataObjects just being created from a template is ignored
Product: platform Reporter: maksym <maksym>
Component: Data SystemsAssignee: Jaroslav Tulach <jtulach>
Status: RESOLVED FIXED    
Severity: blocker CC: issues, issues, kfrank
Priority: P3 Keywords: I18N
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:
Attachments: test
I moved the test to templates module and simplified it a bit. Still fails.

Description maksym 2008-07-03 19:33:56 UTC
When I create new properties file I got the following issue:
# Date: 3 ëèï 2008.  Author: Maksym.

See "ëèï".

The file template for properties file is:  
# Date: ${date}. Author: ${user}.

Encoding for the project is: windows-1251.
Regional standards and formats: Ukrainian.
Long date format: d MMMM yyyy' р.'
Location: Ukraine.
Language for non-Unicode programs: Ukrainian.
Comment 1 Vitezslav Stejskal 2008-07-14 18:12:31 UTC
What happens if you type the month directly to the properties file? And what happens if you do this with the project
encoding set to UTF-8? And on a properties file that does not belong to any project? Also what is your system default
encoding (you can find it in Help->About)? Thanks

CCing Marian who might have come across similar problem.
Comment 2 maksym 2008-07-14 18:45:06 UTC
It is OK when I type the month directly to the properties file 
(either in windows-1251 or utf-8).
When I create new properties in utf-8 the bug is still there.
It is also there if i open properties file without project.

My "Help->About" displays:
Product Version: NetBeans IDE 6.1 (Build 200805300101)
Java: 1.6.0_06; Java HotSpot(TM) Client VM 10.0-b22
System: Windows XP version 5.1 running on x86; Cp1251; uk_UA (nb)
Userdir: D:\PFiles\Settings\NetBeans\6.1
Comment 3 Vitezslav Stejskal 2008-07-15 09:25:47 UTC
Thanks for the info. I vaguely remember that there were some encoding peculiarities in properties files. IIRC the
properties files used to have to be encoded in LATIN-1 (a JDK requirement) or something similar. The properties module
guys should be able to advise further. Btw, is the same working in java files?
Comment 4 maksym 2008-07-15 12:56:44 UTC
It is OK with java files.
Comment 5 Marian Petras 2008-07-15 13:40:55 UTC
This bug was introduced by a fix of P1 bug #102629 ("FileEncodingQuery instantiates DataObject too soon").

Details:
All .properties files have the same encoding (ISO-8859-1) and this encoding is held in Lookups of the corresponding
FileObjects. Before fix of bug #102692, class org.netbeans.modules.openide.loaders.DataObjectEncodingQueryImplementation
used the FileObjects' Lookup to find the encoding. The modification made to fix bug #102629 disabled this piece of code
so the FileEncodingQuery returns the project's default encoding, which is wrong.
Comment 6 Marian Petras 2008-07-16 07:50:35 UTC
Correction: It's a DataObject, not a FileObject, what holds a Lookup.
Comment 7 Marian Petras 2008-07-16 11:26:03 UTC
This is a bug in org.netbeans.modules.openide.loaders.DataObjectEncodingQueryImplementation. It ignores encoding of some
newly created DataObjects under certain circumstances.

I am attaching a test that manifests the bug.
Comment 8 Marian Petras 2008-07-16 11:27:37 UTC
Created attachment 64687 [details]
test
Comment 9 Jaroslav Tulach 2008-08-05 10:02:48 UTC
Test is perfect. I'd love to fix the problem. But I cannot. Issue 102629 is build around not asking the newly created 
objects for FEQI unless they are fully instantiated. And your test check that we do ask for FEQI. What can I do in 
openide.loaders? Please advice.

Moving back to properties, unless some compatible fix is found in openide.loaders. 
Comment 10 Jaroslav Tulach 2008-08-05 10:19:27 UTC
Created attachment 66569 [details]
I moved the test to templates module and simplified it a bit. Still fails.
Comment 11 Marian Petras 2008-12-02 13:40:29 UTC
Moving back to "openide/data systems" - there is no benefit in tracking this bug in "properties".
Comment 12 Jaroslav Tulach 2010-04-07 14:05:36 UTC
core-main#64f590e0c3b6