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 97861 - Update properties data object to use FileEncodingQuery
Summary: Update properties data object to use FileEncodingQuery
Status: RESOLVED FIXED
Alias: None
Product: utilities
Classification: Unclassified
Component: Properties (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker (vote)
Assignee: Marian Petras
URL:
Keywords:
Depends on: 42638
Blocks: 89720 90863 97848
  Show dependency tree
 
Reported: 2007-03-14 16:26 UTC by Tomas Zezula
Modified: 2007-06-20 19:00 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 Tomas Zezula 2007-03-14 16:26:47 UTC
The properties file should use FEQ, see discussion in
http://www.netbeans.org/issues/show_bug.cgi?id=42638.
Comment 1 Marian Petras 2007-03-23 14:36:17 UTC
Accepted.
Comment 2 Marian Petras 2007-04-18 16:19:35 UTC
Fixed in the trunk.

The change resolved also the following issues:
 - issue 89720 ("Cannot display Chinese characters in properties file") 
 - issue 35159 ("Allow searching non-English properties files") 
 - issue 32392 ("Edit Text Rather than Escape Sequences")

Modified files:
   ide/golden/deps.txt   (1.543)
   properties/manifest.mf   (1.69)
   properties/nbproject/project.xml   (1.12)
   properties/src/org/netbeans/modules/properties/:
                                       Bundle.properties   (1.76)
                                       PropertiesDataLoader.java   (1.29)
                                       PropertiesDataObject.java   (1.55)
                                       PropertiesEditorSupport.java   (1.88)
                                       PropertiesEncoding.java   (1.1 - new)
properties/test/unit/src/org/netbeans/modules/properties/:
                                       PropertiesEncodingTest.java   (1.1 - new)

Diffs:
http://ide.netbeans.org/source/browse/ide/golden/deps.txt?r1=1.542&r2=1.543&diff_format=u
http://properties.netbeans.org/source/browse/properties/manifest.mf?r1=1.68&r2=1.69&diff_format=u
http://properties.netbeans.org/source/browse/properties/nbproject/project.xml?r1=1.11&r2=1.12&diff_format=u
http://properties.netbeans.org/source/browse/properties/src/org/netbeans/modules/properties/Bundle.properties?r1=1.75&r2=1.76&diff_format=u
http://properties.netbeans.org/source/browse/properties/src/org/netbeans/modules/properties/PropertiesDataLoader.java?r1=1.28&r2=1.29&diff_format=u
http://properties.netbeans.org/source/browse/properties/src/org/netbeans/modules/properties/PropertiesDataObject.java?r1=1.54&r2=1.55&diff_format=u
http://properties.netbeans.org/source/browse/properties/src/org/netbeans/modules/properties/PropertiesEditorSupport.java?r1=1.87&r2=1.88&diff_format=u
http://properties.netbeans.org/source/browse/properties/src/org/netbeans/modules/properties/PropertiesEncoding.java?rev=1.1&content-type=text/vnd.viewcvs-markup
http://properties.netbeans.org/source/browse/properties/test/unit/src/org/netbeans/modules/properties/PropertiesEncodingTest.java?rev=1.1&content-type=text/vnd.viewcvs-markup
Comment 3 Marian Petras 2007-04-26 14:05:12 UTC
There was a bug in it - see issue #101732. When porting this change remember to
also port the fix:

Modified files:
properties/src/org/netbeans/modules/properties/PropertiesEncoding.java   (1.3)
properties/test/unit/src/org/netbeans/modules/properties/PropertiesEncodingTest.java
                                                                         (1.3)

Diffs:
http://properties.netbeans.org/source/browse/properties/src/org/netbeans/modules/properties/PropertiesEncoding.java?r1=1.2&r2=1.3&diff_format=u
http://properties.netbeans.org/source/browse/properties/test/unit/src/org/netbeans/modules/properties/PropertiesEncodingTest.java?r1=1.2&r2=1.3&diff_format=u
Comment 4 Ken Frank 2007-05-29 18:44:05 UTC
I want to verify this and the others mentioned - some questions that will help
in doing this:

for 32392, what is the user model ?  in that issue one comment was that they 
did not want to need to see the escapped ascii in even the text version of the props
file but its still there now in nb6.

for 35159, i asked in that issue a clarification about verifying it - can you
look at it ?

for 89720, please see my question in that issue also.

ken.frank@sun.com
Comment 5 Marian Petras 2007-06-20 19:00:05 UTC
The model is that .properties files use a special encoding which translates \uxxxx sequences to the corresponding
characters (when reading) and vice versa (when writing). The automatic result of the use of the special encoding is that
whoever reads the file with the proper encoding (i.e. the one obtained via FileEncodingQuery.getEncoding(...)), he gets
real characters in place of \uxxxx sequences. Because the editor uses the proper encoding, real characters are read (and
displayed) in place of the \uxxxx sequences. Similarly, whenever a .properties file is written to the disk, using
encoding obtained via FileEncodingQuery.getEncoding(...), all non-ASCII characters are written as \uxxxx sequences (on
the disk).

The Find feature is one such application of the encoding - while files are searched, they are read using the encoding
obtained from FileEncodingQuery.getEncoding(...) so the core searching routine reads the actual characters instead of
the \uxxxx sequences.

The editor of .properties files is just another application of the same mechanism - while file is being read from the
disk, the \uxxxx sequences are translated to actual characters so the editor only gets the result of the translation -
the actual characters - and displays them as such. Vice versa, when the editor is writing the modified file to the disk,
any non-ASCII characters are translated as \uxxxx sequences while writing and the editor does not need to know about it.