use Encoding; sub U2A { return encode('cp932', shift) } my $path = "some-path-in-japanese-CP932"; if (-d U2A($path)) { chdir U2A($path); my $tmpfile = "some-name-in-CP932"; system(U2A("some_cmd \"other-filename-in-CP932\" $tmpfile")); unlink U2A($tmpfile) if !-s U2A($tmpfile); # etc... }