4

Is there a way to tell what encoding is used for the name and content of a file? Both GUI and terminal solutions (preferred) are fine. Thanks and regards!

enzotib
  • 96,093
Tim
  • 26,107

2 Answers2

4

You could try

chardet <<<filename

The chardet program can try to guess the encoding of the stream on stdin, and <<< is the mean by which bash use a string as stdin, the same as

echo filename | chardet

For a whole directory content you can use

ls dir | chardet

EDIT

I forgot about the content, but is almost the same:

chardet <filename

or

cat filename | chardet

or for all the files in dir

cat dir/* | chardet
enzotib
  • 96,093
2

If you mean mime-encoding you could try file --mime-encoding filename for the content of the file.

Marcel
  • 612