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.
Wrong implementation of FileEncodingQuery for XML data object. The current implementation does not work for saving when the encoding shouldn't be read from a file but rather from a document (the encoding may be changed in the saved xml document).
Here is the patch which should solve the problem and also should avoid double open of file, which is expensive. Unfortunately I didn't find a test for XML file encoding query, I wasn't able to test it.
Created attachment 50179 [details] Patch
Most of the code of the patch comes from FileEncodingQueryTest (project/queries), but I didn't test it much, I only tried to open and save xml files containing Czech letters in different encodings. The patch should be well tested on both JDK 5 and JDK6 before commit (stream encoder has changed in JDK 6).
Please, fix this issue ASAP. Unfortunately it blocks some issue, which has to be solved.
The patch also fixes the issue #117767
*** Issue 117767 has been marked as a duplicate of this issue. ***
Checking in nbproject/project.xml; /cvs/xml/core/nbproject/project.xml,v <-- project.xml new revision: 1.16; previous revision: 1.15 done Checking in src/org/netbeans/modules/xml/api/XmlFileEncodingQueryImpl.java; /cvs/xml/core/src/org/netbeans/modules/xml/api/XmlFileEncodingQueryImpl.java,v <-- XmlFileEncodingQueryImpl.java new revision: 1.7; previous revision: 1.6 done RCS file: /cvs/xml/core/test/unit/src/org/netbeans/modules/xml/api/XmlFileEncodingQueryImplTest.java,v done Checking in test/unit/src/org/netbeans/modules/xml/api/XmlFileEncodingQueryImplTest.java; /cvs/xml/core/test/unit/src/org/netbeans/modules/xml/api/XmlFileEncodingQueryImplTest.java,v <-- XmlFileEncodingQueryImplTest.java initial revision: 1.1 done RCS file: /cvs/xml/core/test/unit/src/org/netbeans/modules/xml/api/data/data.properties,v done Checking in test/unit/src/org/netbeans/modules/xml/api/data/data.properties; /cvs/xml/core/test/unit/src/org/netbeans/modules/xml/api/data/data.properties,v <-- data.properties initial revision: 1.1 done RCS file: /cvs/xml/core/test/unit/src/org/netbeans/modules/xml/api/data/long_encoding.xml,v done Checking in test/unit/src/org/netbeans/modules/xml/api/data/long_encoding.xml; /cvs/xml/core/test/unit/src/org/netbeans/modules/xml/api/data/long_encoding.xml,v <-- long_encoding.xml initial revision: 1.1 done RCS file: /cvs/xml/core/test/unit/src/org/netbeans/modules/xml/api/data/long_no_encoding.xml,v done Checking in test/unit/src/org/netbeans/modules/xml/api/data/long_no_encoding.xml; /cvs/xml/core/test/unit/src/org/netbeans/modules/xml/api/data/long_no_encoding.xml,v <-- long_no_encoding.xml initial revision: 1.1 done RCS file: /cvs/xml/core/test/unit/src/org/netbeans/modules/xml/api/data/short_encoding.xml,v done Checking in test/unit/src/org/netbeans/modules/xml/api/data/short_encoding.xml; /cvs/xml/core/test/unit/src/org/netbeans/modules/xml/api/data/short_encoding.xml,v <-- short_encoding.xml initial revision: 1.1 done RCS file: /cvs/xml/core/test/unit/src/org/netbeans/modules/xml/api/data/short_no_encoding.xml,v done Checking in test/unit/src/org/netbeans/modules/xml/api/data/short_no_encoding.xml; /cvs/xml/core/test/unit/src/org/netbeans/modules/xml/api/data/short_no_encoding.xml,v <-- short_no_encoding.xml initial revision: 1.1 done
whats a scenario that can be used for verifying this issue ? ken.frank@sun.com
I think the scenario was following: Project has one encoding (ISO-8859-1) XML file has other encoding (UTF-8) defined by encoding attribute In the NetBeans editor open the XML file and in the editor change the encoding to UTF-16 and save it. The file was saved in UTF-8 or ISO-8859 depending on the OS. Erno, Am I right?