I'm using /usr/bin/file -i SOME_FILE
to detect whether it contains non-ascii-and-utf characters. However, it produces different result when the application is deployed to apache+passenger.
In 'script/console', above line gives: SOME_FILE: text/plain; charset=utf-8
In passenger, it gives:
SOME_FILE: regular file
Since I am pointing to absolute path of 'file', this is strange. I'm guessing the library used by it is different in Passenger. Any comments?
If this is not the right way to detect a text file's encoding, what is the best approach(in ruby)?
Thank you very much.