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 97873 - Use FileEncodingQuery
Summary: Use FileEncodingQuery
Status: RESOLVED FIXED
Alias: None
Product: web
Classification: Unclassified
Component: HTML Editor (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: J Bachorik
URL:
Keywords:
Depends on:
Blocks: 97848
  Show dependency tree
 
Reported: 2007-03-14 16:57 UTC by Tomas Zezula
Modified: 2009-05-18 10:45 UTC (History)
2 users (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:57:28 UTC
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.)
Comment 1 J Bachorik 2007-06-01 13:11:04 UTC
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
Comment 2 J Bachorik 2007-06-06 11:10:35 UTC
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
Comment 3 Ken Frank 2007-06-06 19:19:06 UTC
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
Comment 4 J Bachorik 2007-06-07 09:24:48 UTC
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.