in reply to Encoding issue

There is the Encode suite of modules. If you have an unknown encoding, Encode::Guess tries its best to guess the encoding.