Hi,
There is no way to automatically determine the encoding of the file.
The same sequence of bytes can be a valid bytes sequence in multiple
encodings that result in different character sequences (what is rendered
to the user). For instance the value C1 is GREEK CAPITAL LETTER ALPHA
in ISO-8859-7 while it is LATIN CAPITAL LETTER A WITH ACUTE in
ISO-8859-15. For files encoded with these encodings there is no
indicator sequence in the file, so it is not that an editor inspects the
file and determines which one is correct, but a human being manually
configuring their editor and maybe trying different encodings until one
of them makes sense. A reasonable strategy today, might be look for a