use strict; use warnings; use utf8; use feature 'unicode_strings'; use charnames ':full'; our $base = "c:\\users\\someuser\\documents"; our $dp = "$base\\documentação"; { my $new_dp = $dp; my $success = utf8::decode($new_dp); print "isutf8 test 1: "; if (utf8::is_utf8($dp)) { print "ok\n"; } else { print "nope\n"; } print "isutf8 test 2: "; if (utf8::is_utf8($new_dp)) { print "ok\n"; } else { print "nope\n"; } print "-d test 1: "; if (-d $dp) { print "ok\n"; } else { print "nope\n"; }; print "-d test 2: "; if (-d $new_dp) { print "ok\n"; } else { print "nope\n"; }; my $dh; print "opendir test 1: "; if (opendir($dh, $dp)) { print "ok\n"; close($dh); } else { print "nope\n"; } print "opendir test 2: "; if (opendir($dh, $new_dp)) { print "ok\n"; close($dh); } else { print "nope\n"; } my $buf; print "dir test 1: "; $buf = `dir /b $dp 2> nul`; chop($buf); if ($buf ne "") { print "ok\n"; } else { print "nope\n"; } print "dir test 2: "; $buf = `dir /b $new_dp 2> nul`; chop($buf); if ($buf ne "") { print "ok\n"; } else { print "nope\n"; } my $r; print "dir test 1: "; $r = system("dir $dp > nul 2> nul"); if ($r == 0) { print "ok\n"; } else { print "nope\n"; } print "dir test 2: "; $r = system("dir $new_dp > nul 2> nul"); if ($r == 0) { print "ok\n"; } else { print "nope\n"; } }