Skip to content

This file is either binary, or too large to be shown. #1538

Closed

Description

@raffibleue

I was on a prior version of dnGrep (unsure which, hadn't updated in several months). Our application has .DAT files which contain html along with some other non-markup text. In the older version of dnGrep, I could click on the .DAT file in the search results pane and the preview would load. In the newest version, I always have to click Preview for every .DAT file regardless of the file size. Playing with Settings > Options > Search results > 'In preview window, ask before loading files larger than' made no difference.

Image

Activity

  1. doug24 commented on Oct 1, 2026

    @doug24
    Contributor

    @raffitchak -
    Given these file sizes, it would not be a file size setting.

    When you say the .DAT files contain html along with some other non-markup text - does that mean it is a zip or other archive file, or is it a single text file with mixed content?

    If it is a text file:
    The binary file detector code was recently changed, but it does not seem that it would give a false positive on a text file. Can you attach a sample file so I can run it in the debugger? I don't know if I can give you more information without seeing a sample file.

    If it is an archive file:
    Add the dat file extension to the list of Archive file extensions in the Options dialog.

  2. raffibleue commented on Oct 1, 2026

    @raffibleue
    Author

    @doug24

    Ok, so it's these special ASCII control chars. It didn't have this behavior before. Just including the chars will trigger the preview blocker. I suppose there's an argument that the code is working as expected then, identifying this as binary. We import/store our markup into a sql db. Seems like we might be a lonely edge case :)

    --start of llm output
    STX (Start of Text): ASCII code 2 (0x02), originally created to mark the beginning of a text block in data transmissions.
    SOH (Start of Header): ASCII code 1 (0x01), originally used to mark the beginning of a message header section.
    --end of llm output

    The extension seems inconsequential in this case, works as a .txt as well. I couldn't upload it here as a .dat.

    Notepad won't render the correct ASCII, Notepad++ will.

    test.txt

    Image Image
  3. doug24 commented on Oct 2, 2026

    @doug24
    Contributor

    Yes, a change to the IsBinary code was made in the August 2026 release to reduce the number of false positives/negatives. A user reported an issue where some .png files were incorrectly detected as text files.

    The new code specifically looks for control characters except for TAB, LF and CR.

    So, your files with control characters are marked as binary.

    It doesn't seem possible to make a test that can handle every unique case. I could add more allowable control characters (are you using any others?) Or I could add an option to skip the control character test in the IsBinary code.

  4. raffibleue commented on Oct 3, 2026

    @raffibleue
    Author

    Thanks for offering some options. Your latter option seems simpler IMO, to skip the control char test.

    Hex Dec Abbr Name


    0x01 1 SOH Start of Heading
    0x02 2 STX Start of Text
    0x05 5 ENQ Enquiry
    0x06 6 ACK Acknowledge
    0x07 7 BEL Bell
    0x09 9 TAB Horizontal Tab
    0x0A 10 LF Line Feed
    0x0D 13 CR Carriage Return

    Image
  5. doug24 commented on Oct 13, 2026

    @doug24
    Contributor

    Fixed in v5.0.65

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions