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.
[ BUILD # : 20050922 ] [ JDK VERSION : 1.5.0_05 ] I open a web.xml file, choose servlet tab, create a new Initialization parameter, and add a description in french, containing characters like éèà. I save the file. And I obtain the following exception: A java.io.UTFDataFormatException exception has occurred. Please report this at http://www.netbeans.org/community/issues.html, including a copy of your messages.log file as an attachment. The messages.log file is located in your C:\Documents and Settings\Vincent\.netbeans\5.0\Daily\20050922\var\log folder. And hereafter the detail: java.io.UTFDataFormatException: Invalid byte 2 of 3-byte UTF-8 sequence. at org.apache.xerces.impl.io.UTF8Reader.invalidByte(Unknown Source) at org.apache.xerces.impl.io.UTF8Reader.read(Unknown Source) at org.apache.xerces.impl.XMLEntityScanner.load(Unknown Source) at org.apache.xerces.impl.XMLEntityScanner.scanContent(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanContent(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source) at org.netbeans.modules.j2ee.ddloaders.web.DDUtils.parse(DDUtils.java:200) at org.netbeans.modules.j2ee.ddloaders.web.DDDataObject.parseDocument(DDDataObject.java:220) at org.netbeans.modules.j2ee.ddloaders.web.DDDataObject.validateDocument(DDDataObject.java:214) at org.netbeans.modules.j2ee.ddloaders.multiview.DDMultiViewDataObject$ModelSynchronizer.updateData(DDMultiViewDataObject.java:215) at org.netbeans.modules.xml.multiview.XmlMultiViewDataSynchronizer$1.run(XmlMultiViewDataSynchronizer.java:45) at org.openide.util.Task.run(Task.java:207) at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:469) [catch] at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:870) And sometimes, but not always, I obtains unreadable characters in the web.xml, in place of éèà
Could this be related to issue 64433 ? Vincent, do you consider this important enough for the beta release, or is it sufficient to fix this after beta? Thanks.
Internationalization issue. This bug will be fixed for FCS.
Vincent, I have tried to follow your steps but I cannot reproduce the problem. Can you please let me know if the problem you desribes happens every time or is random? Even it is obvious from the UTFDataFormatEx, but just for sure - does the web.xml UTF-8 set in the xml header? I tried to put french characters by using french keyboar and also by copypasting some french text from web inside but didn't get the error when saving the file. Also the characters are saved correctly. Can you please attach you web.xml with the french chars so I am able to reproduce it somehow?
UTF-8 is well appearing in the XML file. For me, it should be fixed for the final release of 5.0 (Is FCS means Final Release of 5.0) Please find a step by step flash demo hereafter ftp://ftp-developpez.com/brabant/flash/NetBeans/5.0/issues/65052.html
Vincent, the flash movies is great. Could you zip and attach the webmodule used for the demo besides? I still cannot reproduce using only "éàçè" chars, I suspect there is an another one which causes the problem. Thanks!!!
Created attachment 25198 [details] web.xml used when problem has been encountered
You can find in attach the web.xml file used during the demo
*** Issue 65237 has been marked as a duplicate of this issue. ***
The problem is caused by the DDDataObject incorrectly reading the xml file. The code in the DDDO creates a new InputSource from an InputStream without providing appropriate encoding: The code should look something like this: DDDataObject:195: < return new InputSource(createInputStream()); > InputStream is = createInputStream(); > Sring enc = EncodingHelper.detectEncoding(is); > InputSource isource = new InputSource(is); > isource.setEncoding(enc); > return is; You can find the encoding helper class in org.netbeans.modules.xml.core.lib package of xml/core module. However the class is not public, and you even not depend on the xml/core API. The problem arises when the system's default encoding doesn't correspond to the encoding specified in the web.xml file. In such case the InputSource is created from the InputStream (bytes stream only) with the default encoding. The proposed fix should help. A workaround for reporters: Set system default encoding to the same enc. as specified in the web.xml file or change the enc. in the web.xml. For example to force netbeans to use UTF-8 as default file enc. use: ./netbeans -J-Dfile.encoding=UTF-8 ...
Just a stupid question: I would like to know why I have not same problem when I edit HTML and JSP pages. Those are not XML files, (so not depending of the XML/core api) but can be correctly written, by using the correct encoding. Maybe it would be possible to use the same way than for HTML and JSP pages. No ?
Vincent, the problem described in this issue is caused by the DD code used in the UI configurators (like the one of web.xml). I am not sure, but IMO, without opening this UI editors you will be able to edit the web.xml file without problems. As for the HTML, JSP and XML "plain" editors - the encoding handling is implemented there correctly so you should be able work with national character sets without problems. Does this answer your question?
adding I18N to synopsis for internal tracking I've seen the same kind of exception sometimes on creation of separate xml files also, but maybe that is related since these are xml files also. ken.frank@sun.com
Fixed http://xml.netbeans.org/source/browse/xml/multiview/src/org/netbeans/modules/xml/multiview/EncodingHelper.java?rev=1.1&content-type=text/vnd.viewcvs-markup http://xml.netbeans.org/source/browse/xml/multiview/src/org/netbeans/modules/xml/multiview/Bundle.properties?r1=1.12&r2=1.13 http://xml.netbeans.org/source/browse/xml/multiview/src/org/netbeans/modules/xml/multiview/Utils.java?r1=1.16&r2=1.17 http://xml.netbeans.org/source/browse/xml/multiview/src/org/netbeans/modules/xml/multiview/XmlMultiViewDataObject.java?r1=1.53&r2=1.54 http://xml.netbeans.org/source/browse/xml/multiview/src/org/netbeans/modules/xml/multiview/XmlMultiViewEditorSupport.java?r1=1.51&r2=1.52 http://j2ee.netbeans.org/source/browse/j2ee/ddapi/nbproject/project.xml?r1=1.5&r2=1.6 http://j2ee.netbeans.org/source/browse/j2ee/ddapi/src/org/netbeans/modules/j2ee/dd/api/ejb/DDProvider.java?r1=1.7&r2=1.8 http://j2ee.netbeans.org/source/browse/j2ee/ddapi/src/org/netbeans/modules/j2ee/dd/impl/common/DDProviderDataObject.java?r1=1.3&r2=1.4 http://j2ee.netbeans.org/source/browse/j2ee/ddapi/src/org/netbeans/modules/j2ee/dd/impl/common/DDUtils.java?r1=1.7&r2=1.8 http://j2ee.netbeans.org/source/browse/j2ee/ddloaders/src/org/netbeans/modules/j2ee/ddloaders/multiview/DDMultiViewDataObject.java?r1=1.8&r2=1.9 http://j2ee.netbeans.org/source/browse/j2ee/ddloaders/src/org/netbeans/modules/j2ee/ddloaders/multiview/EjbJarMultiViewDataObject.java?r1=1.52&r2=1.53 http://j2ee.netbeans.org/source/browse/j2ee/ddloaders/src/org/netbeans/modules/j2ee/ddloaders/web/DDDataObject.java?r1=1.11&r2=1.13 http://j2ee.netbeans.org/source/browse/j2ee/ddapi/src/org/netbeans/modules/j2ee/dd/api/ejb/DDProvider.java?r1=1.7&r2=1.8
I just checked with the last QBuild (20051013), and I always have the same problem. So, for me, it's not fixed. Or maybe it was fixed too late for the Qbuild. Does I have to reopen the issue ?
Verified in daily build 200510131922
*** Issue 65855 has been marked as a duplicate of this issue. ***