use strict; use warnings; use utf8; use feature 'unicode_strings'; use charnames ':full'; use Test::More tests => 8; my $dir_with_codes = "documenta\x{00E7}\x{00E3}o"; my $dir_without_codes = "documentação"; my $intrnl_with_codes = "documenta\347\343o"; print "looking for directory (dir_without_codes): $dir_without_codes\n"; ok (-d $dir_with_codes, "With codes (1)"); ok (-d $dir_without_codes, "Without codes (2)"); ### <--- Not OK ok (-d decode_u8($dir_without_codes), "Without codes (3)"); ### Or you can do: my $new_dir_without_codes = $dir_without_codes; my $success = utf8::decode($new_dir_without_codes); ok (-d $new_dir_without_codes, "Without codes (4)"); my ($globbed) = ; is ($globbed, $dir_with_codes, "Glob matches with codes (5)"); is ($globbed, $dir_without_codes, "Glob matches without codes (6)"); is ($globbed, decode_u8($dir_without_codes), "Glob matches without codes (7)"); ok (-e decode_u8($dir_without_codes), "Without codes (8)"); sub encode_u8 { my $s = shift; utf8::encode($s); $s }; sub decode_u8 { my $s = shift; utf8::decode($s); $s };