There is a text file, it is necessary to determine the type of encoding: single-byte or two-byte.

    2 answers 2

    IsTextUnicode will most likely help you. It can also define 2-byte encodings, and find the BOM (if available), and even ENDIAN will determine. Of course, all this does not guarantee 100% result, it already depends on the volume of the source text.

      If the file is in a two-byte encoding, it may contain a BOM character, this character is stored at the beginning of the text and it is not printable. For Windows 1251 encoding, this “n» ї character is also a hexadecimal equivalent. Accordingly, there is no such single-byte encoding. The problem, however, is somewhat wider, because there is UTF-8 without a bom, but this is part of my task. Here is more information about BOM https://ru.wikipedia.org/wiki/%D0%9C%D0%B0%D1%80%D0%BA%D0%B5%D1%80_%D0%BF%D0% BE% D1% 81% D0% BB% D0% B5% D0% B4% D0% BE% D0% B2% D0% B0% D1% 82% D0% B5% D0% BB% D1% 8C% D0% BD% D0% BE% D1% 81% D1% 82% D0% B8_% D0% B1% D0% B0% D0% B9% D1% 82% D0% BE% D0% B2