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 196945

Summary: [70cat] org.openide.text.DataEditorSupport$1: The file cannot be safely opened with encoding UTF-8. Do you want to continue opening it?
Product: platform Reporter: Vladimir Kvashin <vkvashin>
Component: Data SystemsAssignee: Vladimir Voskresensky <vv159170>
Status: RESOLVED FIXED    
Severity: normal CC: amnesyac, anebuzelsky, azizur, bitray, cmygeHm, Ervis_Tusha, everflux, FabianBlechschmidt, gently, HTD, issues, javadimon, jtulach, kwasseem, malinens, masaki, mfukala, mmirilovic, musilt2, n0dwis, pekarna, pjiricka, rudyment, simpatico, St.Ev, Wierrat
Priority: P1    
Version: 7.0   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter: 177783
Attachments: stacktrace
One of projects, where sometimes the notice occures

Description Vladimir Kvashin 2011-03-22 08:27:42 UTC
This bug was originally marked as duplicate of bug 196219, that is already resolved. This bug is still valid, so this seems to be another bug, but it might be related.

Build: NetBeans IDE Dev (Build 20110322-bafd30f81c3e)
VM: Java HotSpot(TM) Client VM, 11.0-b15, Java(TM) SE Runtime Environment, 1.6.0_10-b33
OS: Windows XP

User Comments:
vkvashin: After I added a new source file to full remote project on Windows, exception occurs.
I guess it's because of date that is insterted into file in Russian

GUEST: SVN update.

GUEST: I clicked the tab of source editor to changing the source file for editing.

St.Ev: go to declaration method

GUEST: ??jsp???????

GUEST: clicked on new BreadCrumb();

everflux: control-click on a php function, the file where the functions is has a bad enconding.
this would normally (manually opening the file) result in the alert box "file cannot safely be opened with encoding / want to continue?"

GUEST: clicking a function

GUEST: please resove the problem!Thank you!

GUEST: ????

rudyment: The exception occurred by renaming a class. However before this class another class was renamed without problems.

FabianBlechschmidt: tried to jump to the definition of the class via Command + Click on "new CLASSNAME"

pekarna: Clicked on the link in a Maven-based project build log.
Probably related to the content of the file, perhaps encoding conversion error.

COMPILATION ERROR : 
-------------------------------------------------------------
com/rapidlime/pohlidame/web/panel/registrace/RegistrationMailSender.java:[16,18] unmappable character for encoding utf-8

GUEST: ??jsp??

GUEST: When I open the .jsp file ,it have problem ,please help me to resove it,Thank you very much!

GUEST: under php i would like to go to class who extends another class, key ctrl+left click

GUEST: try to redirect to function by press ctrl+mouse click

malinens: ctrol + open function to go to it's declaration

amnesyac: Ctrl+Click on require_once file path. Expected to navigate to this file, but error ocquired.

St.Ev: go to declarete

kwasseem: steps:
=> Ctrl + Right-Click to go to definition

Observation:
=> There was like 8 choices in the drop-down for me to choose which class I wanted to look for the function I wanted to go 'to the definition of'.
When I clicked, then I got this error. It happened 6th time today..

Further Info:
=> This same error happened when I created a new project from an existing source - this one I got it 2 times only

I'm not sure what exactly could have caused this error, but I have got it too many times today and is quite frustrating..

Hope this can be fixed, cheers!
//K. Wasseem

GUEST: I clicked at source link in compiler error output

GUEST: DBManager::getInstance(self::$connection)->update_row("cms_item_values", $bean->__toArray(), $row_idx);

Click Ctrl + LMB on "update_row"

GUEST: thank you . I want to problem , please

Wierrat: file have incorrect cp1251 encoding

GUEST: I try to open utf8 source file by CTRL+click on method in cp1251 source file. I guess it should be yes/no question, but exception given.




Stacktrace: 
org.openide.text.DataEditorSupport$1: The file cannot be safely opened with encoding UTF-8. Do you want to continue opening it?
   at org.openide.text.DataEditorSupport.loadFromStreamToKit(DataEditorSupport.java:434)
   at org.openide.text.CloneableEditorSupport.loadDocument(CloneableEditorSupport.java:2156)
   at org.openide.text.CloneableEditorSupport.access$2800(CloneableEditorSupport.java:133)
   at org.openide.text.CloneableEditorSupport$Listener.run(CloneableEditorSupport.java:2986)
   at org.openide.text.CloneableEditorSupport$3.doRun(CloneableEditorSupport.java:710)
   at org.openide.text.CloneableEditorSupport$3.run(CloneableEditorSupport.java:677)
Comment 1 Vladimir Kvashin 2011-03-22 08:27:45 UTC
Created attachment 107174 [details]
stacktrace
Comment 2 Exceptions Reporter 2011-03-24 15:24:58 UTC
This bug already has 100 duplicates 
see http://statistics.netbeans.org/exceptions/detail.do?id=177783
Comment 3 Marian Mirilovic 2011-03-25 15:00:27 UTC
This is last 'not yet evaluated' P1 in 7.0 . Could somebody do quick evaluation ? Thanks in advance.
Comment 4 Antonin Nebuzelsky 2011-03-25 15:30:26 UTC
Related to the fix of issue 191323.

David will have a look.
Comment 5 David Strupl 2011-03-25 15:51:20 UTC
Vladimir, this is coming from your patch ... can you please have a look? Thanks.
Comment 6 Vladimir Voskresensky 2011-03-25 17:27:30 UTC
can someone attach sample project to reproduce the issue?
Comment 7 everflux 2011-03-25 18:11:59 UTC
(In reply to comment #6)
> can someone attach sample project to reproduce the issue?

Sorry I don't have the project where it occured.
I triggered the problem by not openening the file through the navigator or "open..." search box, but by clicking "hyperlink in code" (when holding the control key)
I assume the hyperlink navigation triggeres a different code path.
Comment 8 rudyment 2011-03-27 12:36:47 UTC
Created attachment 107312 [details]
One of projects, where sometimes the notice occures

Here is on of "problematic" projects. However the dialog notifying the seemingly problematic file appears only by first attemtp to open the file. After closing this file, the next oppening passes off sithout problems.
Comment 9 Vladimir Voskresensky 2011-03-28 07:52:04 UTC
rudyment, thanks for the project. I was able to reproduce incorrect refjecting of true UTF-8 file.
And I have a fix for that (which fixes issue #196707 as well)
Comment 10 Vladimir Voskresensky 2011-03-28 18:52:55 UTC
fixed.
http://hg.netbeans.org/cnd-main/rev/1b8d3b85a037
Please, review and verify
Comment 11 Quality Engineering 2011-03-29 08:41:06 UTC
Integrated into 'main-golden', will be available in build *201103290400* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/1b8d3b85a037
User: Vladimir Voskresensky <vv159170@netbeans.org>
Log: fixed #196945 -  [70cat] org.openide.text.DataEditorSupport$1: The file cannot be safely opened with encoding UTF-8. Do you want to continue opening it?
-- check content of whole file, otherwise we incorrectly reject UTF-8 and also can corrupt user's file without notification (issue #196707 -  Changes are made to unedited French characters while saving a file)
Comment 12 Petr Jiricka 2011-03-29 13:23:19 UTC
Hi Vladimir, in the build where this fix appeared, one of the HTML encoding tests started failing:
http://bertram.netbeans.org/hudson/job/javaee/2459/testReport/junit/org.netbeans.modules.html/EncodingTest/testLoadOfWrongEncoding/

Marek Fukala is the owner of this test, but he is on vacation until Wednesday. Could I please ask you to investigate whether the failure is related to your change, or whether it's unrelated? Thanks.
Comment 13 Vladimir Voskresensky 2011-03-29 17:58:51 UTC
Hi Petr,
this test was modified as part of issue
194634 -  Failing tests on the javaee build job
But instead of commenting it out, it was reversed in logic.

I've checked in gedit and firefox and 
"wrongencoding.html" is correct UTF-8 file...
I think test should be back outed to previous state:
    public void testLoadOfWrongEncoding () throws Exception {
        HtmlEditorSupport.showConfirmationDialog = false;
        checkEncoding (null, "wrongencoding.html", false);
    }
Comment 14 Vladimir Voskresensky 2011-03-29 18:02:33 UTC
Peter,
I've made it as http://hg.netbeans.org/cnd-main/rev/5fa8cc372598
Please, ask Marek to verify
Comment 15 Antonin Nebuzelsky 2011-03-30 14:53:59 UTC
Vladimir, will you be able to integrate the fix of this bug today, so that it appears in today's nightly 7.0 build?
Comment 16 Vladimir Voskresensky 2011-03-30 19:08:40 UTC
I reviewed and have pushed Jan Lahoda's fix into trunk
http://hg.netbeans.org/cnd-main/rev/b3fb8e05da46
Comment 17 Quality Engineering 2011-03-31 08:48:08 UTC
Integrated into 'main-golden', will be available in build *201103310400* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/b3fb8e05da46
User: Vladimir Voskresensky <vv159170@netbeans.org>
Log: better fix (read once) for #196945  The file cannot be safely opened with encoding UTF-8
Comment 18 Marian Mirilovic 2011-03-31 13:07:23 UTC
What is the status of this issue ? Looks like beside CND issues this one is the last not yet integrated into rlease70 branch. Please do it ASAP! Thanks.
Comment 19 Vladimir Voskresensky 2011-03-31 16:04:54 UTC
editor team,
are you OK if I integrate it into release70?
Comment 20 Jan Lahoda 2011-04-01 14:05:30 UTC
I this needs to be fixed in 7.0, I am OK with the last patch.
Comment 22 Quality Engineering 2011-04-07 08:45:44 UTC
Integrated into 'main-golden', will be available in build *201104070400* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/6c55c7e4ce5d
User: Jan Lahoda <jlahoda@netbeans.org>
Log: #196945: proper handling of UserQuestionException in CSL's UiUtils.doOpen.