Binary format to human readable text

I have a file containing data in binary format, and the requirement is to extract its contents by executing a specific command. However, I want to avoid this approach and instead read the data directly using client relevance.

When attempting to parse the lines of file, I encounter the following error:

E: CharacterSetResult: FileLineLoop::TranscodeHelper: UErrorCode=10 [U_INVALID_CHAR_FOUND] ["\xC1"].

I have not been able to find a method to handle this directly through client relevance. Would you have any suggestions or guidance to address this?

Note: its related to CrowdStrike!

The ‘lines of file’ inspector expects to find readable text, either ASCII or UNICODE (and there are additional inspectors to force particular UNICODE encodings). If this is a true binary file, you will not be able to use ‘lines’ or ‘characters’ inspectors. Instead you’d have to parse the file bytewise. It may be helpful to know more about your use-case, but here are a few examples that may be helpful.

q: size of file "c:\temp\test.exe"
A: 18608112

q: byte 0 of file "c:\temp\test.exe"
A: 77

q: (it as hexadecimal) of byte 0 of file "c:\temp\test.exe"
A: 4d

q: (it as hexadecimal) of bytes (integers in (0,5)) of file "c:\temp\test.exe"
A: 4d
A: 5a
A: 90
A: 0
A: 3
A: 0

q: (it as hexadecimal) of bytes (integers in (0,size of it)) of file "c:\temp\test.exe"
3 Likes

If the file is mostly human-readable ASCII text but contains a small bit of embedded binary, another option might be to read the file bytewise, and show the ASCII character where the byte is in the ASCII range 1-125, and to display the binary portions as \0x hexadecimal otherwise (or substitute whatever escaping you want)


q: concatenation of (if (it > 0 and it < 126) then character(it) else ("\0x" & last 2 of ("0" & it as hexadecimal))) of bytes (integers in (0,120)) of file "c:\temp\test.exe"
A: MZ\0x90\0x00%03\0x00\0x00\0x00%04\0x00\0x00\0x00\0xff\0xff\0x00\0x00\0xb8\0x00\0x00\0x00\0x00\0x00\0x00\0x00@\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00(%01\0x00\0x00%0e%1f\0xba%0e\0x00\0xb4%09\0xcd!\0xb8%01L\0xcd!This program cannot be run in DOS mode.%0d%0d%0a$
2 Likes