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 97872 - I18N - Use FileEncodingQuery
Summary: I18N - Use FileEncodingQuery
Status: RESOLVED FIXED
Alias: None
Product: xml
Classification: Unclassified
Component: Code (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker (vote)
Assignee: Samaresh Panda
URL:
Keywords: I18N
: 107911 (view as bug list)
Depends on:
Blocks: 97848 111954 111955
  Show dependency tree
 
Reported: 2007-03-14 16:57 UTC by Tomas Zezula
Modified: 2007-08-29 02:15 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:57:24 UTC
The XML 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 XML 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 Ken Frank 2007-06-03 20:11:52 UTC
if xml file has encoding tag, does it override the encoding provided by this issue ?
or is the xml file encoding tag used just for runtime ?

ken.frank@sun.com
Comment 2 Ken Frank 2007-06-25 18:53:08 UTC
Can this (and 107911) be done for nb6 ?
Most other project types, especially all those in core
areas, have implemented this and it seems
important for consistency to user that xml
files be done in same way.

As to 107911, the new xml file created would use
the project encoding value (or default fallback encoding)
for the value of the encoding tag put into the file)

ken.frank@sun.com
Comment 3 Ken Frank 2007-06-25 19:00:59 UTC
What about for other project/file types that create an xml file
> in which
>  currently the template and implementation assumptions is that UTF-8
> is to be used
> for encoding ?
> (like various xml files, vwp page files, tag files, various other xml
> files
> for many projects like control files/config files  or like for soa or
> xmltools
> in which the xml file is the file that also has the design or other
> views ?

---> shouldn't these stay as using utf-8 vs the feq value ?

or does it matter ?


ken.frank@sun.com
Comment 4 Ken Frank 2007-07-08 03:13:11 UTC
another question is - should there be separate issue for how encoding is handled by
wsdl files, xsdl from database, dtd entities, xsl stylesheet, jaxb binding -- or are all of those
considered xml data objects ?

If separate issues needed for file types above, let me know and they can be filed.

ken.frank@sun.com
Comment 5 Ken Frank 2007-07-15 20:30:20 UTC
please reply to questions and comments below - all other feq related project and file encoding handling
is done or almost done for all project types all for jsp and html files - thus for consistency
it seems it will be good if xml files can be done as well.

please answer for 107911 also.

also, if this will be done, need answers since am writing an overall spec/info for docs team and for qe testing spec.

ken.frank@sun.com
Comment 6 Ken Frank 2007-08-14 16:14:29 UTC
now this has been done for jsp and html files; and developer in other area was asking about this
one and 107911 related to issues in their areas (that is, they need to fix some encoding problems
but approach might be different once these are implemented.

ken.frank@sun.com
Comment 7 Nikita Krjukov 2007-08-16 15:30:43 UTC
I changed the priority to P2 because it blocks my P2 issues
Comment 8 Samaresh Panda 2007-08-16 23:42:27 UTC
*** Issue 107911 has been marked as a duplicate of this issue. ***
Comment 9 Nikita Krjukov 2007-08-17 13:31:36 UTC
Now the correct encoding is read for BPEL and WSDL files. 
You can see comments in the Issue #111955.
Comment 10 Nikita Krjukov 2007-08-20 11:21:42 UTC
I suppose the new FEQ approach isn't used by many modules yet. 
And it can come to variouse strange I18N behaviours. 

The new XmlFileEncodingQueryImpl class is located in the XML Core module 
and it can be used easily by other XML related modules. 
But it requires some efforts of authors of corresponding modules because 
it's sometime dufficult to do in a code which is written by somebody else.
Comment 11 Samaresh Panda 2007-08-29 02:15:46 UTC
Fix integrated:
/cvs/xml/core/src/org/netbeans/modules/xml/api/XmlFileEncodingQueryImpl.java,
new revision: 1.2; previous revision: 1.1
/cvs/xml/core/src/org/netbeans/modules/xml/core/XMLDataObject.java,
new revision: 1.38; previous revision: 1.37
/cvs/xml/core/src/org/netbeans/modules/xml/core/DTDDataObject.java,
new revision: 1.23; previous revision: 1.22
/cvs/xml/core/nbproject/project.xml,v  <--  project.xml
new revision: 1.14; previous revision: 1.13

/cvs/xml/schema/src/org/netbeans/modules/xml/schema/SchemaDataObject.java,v  <--  SchemaDataObject.java
new revision: 1.4; previous revision: 1.3
/cvs/xml/schema/nbproject/project.xml,v  <--  project.xml
new revision: 1.9; previous revision: 1.8

Note:
The way it works is, first it tries to read the encoding from the file. If found, returns it, if not, returns the
project level encoding.