Some OS X apps like Textedit do store the file encoding of the files as an attribute named: “com.apple.TextEncoding“.
Find out if the file has attributes defined
First we open the terminal and go where our file is located. Once we are in the right folder use the ls command:
You may see something like this:
-rw-r--r--@ 1 root group1 4337433 17 Oct 16:30 example.txt
Pay attention to the “@” character next to the permissions. That means that some attributes have been defined for the file so it’s quite likely that the file encoding is one of them.
Show me the encoding!
Just run the following command:
file -I example.txt
This may work as well:
xattr -p com.apple.TextEncoding example.txt