Converting an application/octet-stream file to ASCII
Recently, I came across a weird issue where an output from our UNIX based service renders a file type of “application/octet-stream”. To confirm this, I took the file and verified it by running the ‘file’ command:
$ file -bi filename application/octet-stream; charset=binary
Well, after a bit of reading, it turns out that our UNIX application embeds NUL characters within the file rendering it as such. To fix this quirky issue, I ran the following command:
$ cat filename | tr -d '\0' > fixed_filename
The same ‘file’ command to confirm:
$ file -bi filename text/plain; charset=us-ascii
Problem solved.
Had exactly same issue with a service I was trying to use. This fixed it.
Thankyou!
Very glad I could be of any assistance, thanks!
thanks a lot… it’s work !
Glad you found it useful. Thanks!