Oracle Solaris includes auto_ef(1), a command-line utility to identify the encoding of a file. auto_ef judges the encoding by using the iconv code conversion, determining whether a certain code conversion was successful with the file. It also performs frequency analysis on the character sequences that appear in the file. For example,
$ auto_ef test_file eucJP
With the -a option, it displays all possible encodings for the given file:
$ auto_ef -a test_file eucJP 0.89 zh_CN.euc 0.40 ko_KR.euc 0.01
To add auto_ef to your system install the text/auto_ef package. For more information, see the auto_ef(1) man page.