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.
The HTML data object should provide or at least use FileEncodingQuery to read store in correct encoding. The best solution is not to overide loadStreamToKit and saveKitToStream and provide implementation of the FileEncodingQueryImplementation which detects an encoding inside the HTML file when available. This allows not only editor but all other features like search and other which works directly on FileObject level to read the file in the correct encoding. The minimal change for NB 6.0 should be to use FEQ in case when no encoding has been found in the loadFromStreamToKit or saveFromKitToStream. (When no encoding is inside the HTML file the project encoding should be used.)
I have prepared a patch for FileEncodingQuery functionality. It goes like this: 1. An HTML file encoding is by <META Content...> tag inside the file 2. If there is no <META Content...> tag inside the HTML file the "ENCODING" property of the corresponding FileObject is consulted for the used encoding. The "ENCODING" property is accessible from the file's property sheet. 3. If there is neither <META Content...> tag or "ENCODING" property defined then the owning project's encoding is used 4. If none of the previous cases is true the system's default encoding is used If you have any comments, let me know
Committing the proposed implementation Checking in nbproject/project.xml; /cvs/html/nbproject/project.xml,v <-- project.xml new revision: 1.15; previous revision: 1.14 done Checking in src/org/netbeans/modules/html/HtmlDataNode.java; /cvs/html/src/org/netbeans/modules/html/HtmlDataNode.java,v <-- HtmlDataNode.java new revision: 1.14; previous revision: 1.13 done Checking in src/org/netbeans/modules/html/Bundle.properties; /cvs/html/src/org/netbeans/modules/html/Bundle.properties,v <-- Bundle.properties new revision: 1.20; previous revision: 1.19 done Checking in src/org/netbeans/modules/html/HtmlEditorSupport.java; /cvs/html/src/org/netbeans/modules/html/HtmlEditorSupport.java,v <-- HtmlEditorSupport.java new revision: 1.18; previous revision: 1.17 done Checking in src/org/netbeans/modules/html/HtmlDataObject.java; /cvs/html/src/org/netbeans/modules/html/HtmlDataObject.java,v <-- HtmlDataObject.java new revision: 1.25; previous revision: 1.24
for the spec below - item 2 - it mentions the encoding property of the file object - where does that property itself come from ? Now that project types have an encoding property - does that property impact the encoding property of html file as created ? Also, html files created from a web project file-> new are seeded with meta charset tag, so for these, does that tag come from project properties ? But html files under file->new->other are not seeded with meta charset tag, so their encoding property shows something diffferent - perhaps that of system ? (there is bug on this to have it use a meta charset tag) ---> Could you clarify the spec related to above questions - this will help in testing/verifying. ken.frank@sun.com
the ENCODING property is accessible in the property sheet of an HTML file - by default it's emtpy so the project's encoding is used (item 3 in spec). the HTML file generation process was not changed in any way - the newly created HTML files don't use the project's encoding property for seeding their meta charset tag - this would be nice to have but it wasn't within the scope of this issue AFAIK - probably another RFE can be filed.