in reply to Easy detection of BOM

Encode::Detective, Encode::Guess may be of interested