use Unicode::String qw(utf8 utf16 latin1); Unicode::String->stringify_as("utf8"); while (<>) { print utf8($_)->latin1(); }