Any encoding detection program can only be heuristic when it comes to encodings which are basically valid for all files (e.g. ones which are always one byte per character and have a character mapped to every byte).
You should encode some text which you know would cause different results between Windows-1250 and Windows-1252, and see what your code actually does. I suspect you'll find it's actually doing the right thing.