my @l = grep /utf-?8/, PerlIO::get_layers($handle{$file}); warn @l / 2;