I am not sure whether it is applicable to your particular problem, but you seem to be in the general vicinity of
Encode::Detect, which, as a side note, my colleague was unable to build on Win32 last week. He will give it another try.
fenLisesi turns toward the Monks. If there are users of this module, would you care to share your experience with it, please? Cheers.