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.
I've created projects under NetBeans 6.x with encoding ISO-8859-15 and html files inside the project were shown as ISO-8859-15 too. But with NetBeans 7.0 Beta (and NetBeans 7.0 M2) html files are randomly shown/edit as UTF-8 (visible in the file properties). Product Version = NetBeans IDE 7.0 Beta (Build 201011152355) Operating System = Windows XP version 5.1 running on x86 Java; VM; Vendor = 1.6.0_20 Runtime = Java HotSpot(TM) Client VM 16.3-b01
Marek, could it be caused by your changes in supporting HTML5? If not please pass back to me and I will have a look. Thx.
Html parsers doesn't influence the FEQ result at any way. I've looked at the issue and realized the behavior is caused by Tomas Zezula's FEQ performance optimalization before some time. The problems happens only for file which doesn't specify its encoding either by BOM or by <meta> tag in the code. For such files the Html's FEQ returns UTF-8 instead of returning null and letting the other FEQ providers (mainly the project's one) to supply their values. The issue is there due to the nature of the optimalization. At the beginning the FEQ always returns a proxy charset whith a patched decoder which then updates the encoding during the file content to chars conversion when the document is being loaded. To be able to do this lazy encoding detection, you need to return an instance of charset *with some encoding*. So the FEQ can never return null and hence work normally, e.g. fallback to the project's FEQ.
The possible solution is: Charset getEncoding(...) { if (threadLocalVariagle().get() == Boolean.TRUE) { //Ask by me, do nothing return null; } ...... //Current code if (noEncodingFound) { threadLocalVariable.set(Boolean.TRUE); try { return FEQ.getEncoding(); } finally { threadLocalVariable.remov(); } }
Thanks. I was a bit afraid of calling back to the FEQ from inside it (not meaning the cycle - returning itself from within), but if you propose it I
fixed in web-main#66987434fb83
Integrated into 'main-golden', will be available in build *201011260001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main/rev/66987434fb83 User: Marek Fukala <mfukala@netbeans.org> Log: #192174 - Project with encoding ISO-8859-15 shows files as UTF-8