9 print "1..0 # Skip: Cygwin doesn't support Unicode filenames\n";
12 unless (defined &Win32::BuildNumber && Win32::BuildNumber() >= 820 or $] >= 5.008009) {
13 print "1..0 # Skip: Needs ActivePerl 820 or Perl 5.8.9 or later\n";
16 unless ((Win32::FsType())[1] & 4) {
17 print "1..0 # Skip: Filesystem doesn't support Unicode\n";
20 unless ((Win32::GetOSVersion())[1] > 4) {
21 print "1..0 # Skip: Unicode support requires Windows 2000 or later\n";
26 my $home = Win32::GetCwd();
27 my $dir = "Foo \x{394}\x{419} Bar \x{5E7}\x{645} Baz";
28 my $file = "$dir\\xyzzy \x{394}\x{419} plugh \x{5E7}\x{645}";
32 my $ansi = Win32::GetANSIPathName($file);
33 unlink($ansi) if -f $ansi;
34 $ansi = Win32::GetANSIPathName($dir);
35 rmdir($ansi) if -d $ansi;
43 # Create Unicode directory
44 Win32::CreateDirectory($dir);
45 ok(-d Win32::GetANSIPathName($dir));
48 Win32::CreateFile($file);
49 ok(-f Win32::GetANSIPathName($file));
51 # readdir() returns ANSI form of Unicode filename
52 ok(opendir(my $dh, Win32::GetANSIPathName($dir)));
53 while ($_ = readdir($dh)) {
55 ok($file, Win32::GetLongPathName("$dir\\$_"));
59 # Win32::GetLongPathName() of the absolute path restores the Unicode dir name
60 my $full = Win32::GetFullPathName($dir);
61 my $long = Win32::GetLongPathName($full);
63 ok($long, Win32::GetLongPathName($home)."\\$dir");
65 # We can Win32::SetCwd() into the Unicode directory
66 ok(Win32::SetCwd($dir));
67 ok(Win32::GetLongPathName(Win32::GetCwd()), $long);
69 # cwd() also returns a usable ANSI directory name
70 (my $cwd = cwd) =~ s,/,\\,g;
71 ok(Win32::GetLongPathName($cwd), $long);
73 # change back to home directory
75 ok(Win32::GetCwd(), $home);
77 # We can chdir() into the Unicode directory if we use the ANSI name
78 ok(chdir(Win32::GetANSIPathName($dir)));
79 ok(Win32::GetLongPathName(Win32::GetCwd()), $long);