in reply to Unicode nightmare
You might want to have a look at the Encode:: namespace on CPAN.
Encode-Detect