I need to detect a file type and encoding in Ruby.
I'm currently using libmagic through the magic gem, but it has one problem: it doesn't detect UTF-16 files if they don't have BOM. This is an example of such file.
$ file -i text_without_bom.txt
text_without_bom.txt: application/octet-stream; charset=binary
Is there any other library or method I could use that would detect UTF-16 files properly?
P. S. Also tried rchardet and charlock_holmes, without much luck.