Subject: | W variants seem to include trash in filename strings |
With this example script, either the first one will generate a file with random bytes at the end of its name; or the latter one will fail to find a.bak due to searching for a file with random bytes and/or different random bytes at its end.
Dunno if i'm using this wrong or whether it's an XS issue.
use Encode;
use Win32API::File qw( MoveFileW fileLastError );
open my $f, ">", "a"; close $f;
sleep 1;
MoveFileW encode( "UTF16-LE", "a" ), encode( "UTF16-LE", "a.bak" ) or die fileLastError;
sleep 1;
MoveFileW encode( "UTF16-LE", "a.bak" ), encode( "UTF16-LE", "a" ) or die fileLastError;