um, I think you'll have to do what these modules do (look inside)
Encode::Detective - detect a data encoding
Encoding::FixLatin - takes mixed encoding input and produces UTF-8 output
Encode::DoubleEncodedUTF8 - Fix double encoded UTF-8 bytes to the correct one
Encode::Repair - Repair wrongly encoded text strings