use Encode qw(from_to); while (<>) { from_to($_,'latin1','utf-8'); print; }