C# Класс GettextLib.ExpressionEvaluator.Scanner.Guesser
This class provides a simple finite state automaton that scans the file looking for (1) valid UTF-8 byte patterns, (2) bytes >= 0x80 which are not part of a UTF-8 sequence. The method then guesses whether it is UTF-8 or maybe some local machine default encoding. This works well for the various Latin encodings.