In the past PSPad detects ansi/utf-8 files only. For east Europe charsets it
detects DOS too.
Now it is able detect wide range of charsets. Your "guessing" means he
calculates chars from each file, evaluates char weight in each charset and
winner is selected.
I agree, it isn't 100%, but it isn't random.

If you want to help and improve autodetection, I need files with wrong detection
and info about correct code page.

If file contains few accented chars only, the detection is hard.

PSPad freeware editor

Odpovedet emailem