VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Updated Determine if a file is binary or text

by NeBaGeMo (1 Submission)
Category: Files/File Controls/Input/Output
Compatability: VB Script
Difficulty: Intermediate
Date Added: Wed 3rd February 2021
Rating: (3 Votes)

Compares a file's contents to a predefined byte-table. If a match is found, the file is classified as binary.
I've extracted the byte-table from over 4500 different textfiles in both ANSI and ASCII standard (well over 200 Mb.) The bytes in the table do not occur in any of the following filetypes: .BAT, .TXT, .HTM, .INI, .JS, .BAS, .INC, .LOG, .VBP, etc.
Because of this it's pretty plausible to state that if a file should contain any of the bytes in the table, it MUST be binary. I do not expect this routine to be 100% accurate but for the purpose of deciding whether to open a file in a text-editor or a hex-editor this will do just fine.
please keep in mind that the original byte-table is a bit larger (mail me to get a list) but comparing the rest as well does not provide more accuracy and will lead to false interpretation of localized files.

Rate Updated Determine if a file is binary or text

Download Updated Determine if a file is binary or text

Download Updated Determine if a file is binary or text (3 KB)

Updated Determine if a file is binary or text Comments

No comments have been posted about Updated Determine if a file is binary or text. Why not be the first to post a comment about Updated Determine if a file is binary or text.

Post your comment

Subject:
Message:
0/1000 characters