As I started to mention in this thread Checking for filetypes?:
I'm writing a script that will search files that contain certain keywords, and then output the line to a text file.
The problem I'm having is that the script is opening every type of file, including executables.
The script seems to work fine, as in it doesn't crash when it opens these types of files, but the problem I'm having is with the output.
When the script outputs text from some type of non-text-based file, I cannot open the file with gedit. It gives me the "gedit has not been able to detect the character encoding."
Can I force the script to output using a specific encoding so that I can open and read the output file in a text editor such as gedit?
The script itself will be run on Linux.
Thanks.
Jason