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 112379 - I18N - "Binary File Detected" check ignores encoding
Summary: I18N - "Binary File Detected" check ignores encoding
Status: RESOLVED WONTFIX
Alias: None
Product: platform
Classification: Unclassified
Component: Data Systems (show other bugs)
Version: 6.x
Hardware: All All
: P4 blocker (vote)
Assignee: Jiri Skrivanek
URL:
Keywords: I18N
Depends on:
Blocks:
 
Reported: 2007-08-09 04:24 UTC by err
Modified: 2009-12-21 06:10 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
file that produces error dialog on nb6 (1.42 KB, text/plain)
2008-02-13 16:50 UTC, err
Details

Note You need to log in before you can comment on or make changes to this bug.
Description err 2007-08-09 04:24:38 UTC
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.
Comment 1 Karthikeyan Rajeswaran 2007-08-09 19:36:26 UTC
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.
Comment 2 Karthikeyan Rajeswaran 2007-08-09 19:39:54 UTC
Also discussed at: http://www.netbeans.org/servlets/BrowseList?list=nbusers&by=thread&from=802862
Comment 3 err 2007-08-09 20:25:16 UTC
> 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.
Comment 4 Ken Frank 2007-12-13 16:00:21 UTC
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
Comment 5 Jaroslav Tulach 2008-02-13 09:40:25 UTC
Give me a sample file that is broken for you.
Comment 6 err 2008-02-13 16:50:59 UTC
Created attachment 56631 [details]
file that produces error dialog on nb6
Comment 7 err 2008-02-13 16:55:58 UTC
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)
Comment 8 Antonin Nebuzelsky 2008-11-13 13:35:09 UTC
Reassigning all openide/data systems issues to the new owner jskrivanek.
Comment 9 Quality Engineering 2009-12-21 06:10:32 UTC
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