Let's suppose we have a text file but we don't know its encoding and code page. What is the best way to try to 'guess' the encoding. Some programs use so called 'frequency tables' for that (generally it's a table with the list of characters used and their 'frequency', i.e. how often this character is encountered). The drawback is that these tables are language specific. A table for English wouldn't work with Russian text, etc. Besides, there are many encodings even for one language (UTF-8, ISO, ASCII, etc).
Is there a way other than frequency table that can detect an encoding at least?