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.
In a project with encoding utf-16, I'm opening a file with a presumably unknown type, .kmp. I'm getting the dialog "Binary File Detected" "This file appears to contain binary data. Are you sure you want to open it in the text editor?" from org/openide/loaders/DefaultDataObject.java. The heuristic for determining binary file doesn't take project's encoding into account.
Does (or should) the default handler check whether the data is binary or not? Perhaps the message should be: The file (extension <.xxx>) is not recognized by the ide and may not open properly. Do you wish to open the file in the text editor? The message box could have a couple of checkboxes like 'Do not ask this question for this type for this session' and/or 'Always open files of this type/extension in the text editor'. The default handler could maintain the lists of such types/extensions and not show the dialog further depending on user's choice.
Also discussed at: http://www.netbeans.org/servlets/BrowseList?list=nbusers&by=thread&from=802862
> Does (or should) the default handler check whether the data is binary or not? DefaultDataObject does check the data; it examines the first 2K bytes doing: if (arr[i] >= 0 && arr[i] <= 31 && arr[i] != '\n' && arr[i] != '\r' && arr[i] != '\t') { return null; } This heuristic assumes a single byte gets turned into a char (AFAIK, I'm no encoding expert). If it read the data from the file with an InputStreamReader, useing the correct encoding, into a char array then the heuristic might produce much better results. Broadening the set of "binary" chars is also a consideration.
does this still happen with current nb6 ? there have been some additions to encoding handling and encoding properties since this issue was filed. ken.frank@sun.com
Give me a sample file that is broken for you.
Created attachment 56631 [details] file that produces error dialog on nb6
I didn't try nb6.1. (I noticed the message of Dec13 from Ken Frank, I don't remember having seen it. I apologize for not responding)
Reassigning all openide/data systems issues to the new owner jskrivanek.
This bug was reported against NetBeans IDE 6.0 or an older release, or against a non-maintained module. NetBeans team does not have enough resources to get to this issue, therefore we are closing the issue as a WONTFIX. If you are interested in providing a patch for this bug, please see our NetFIX guidelines for how to proceed. We apologize for any inconvenience. Thank you. The NetBeans Team