in reply to utf8::downgrade() and file system operators

The BUGS section of utf8 to which you linked begins with the qualification

Some filesystems may not support ...

I take that to mean that the behaviour you have encountered may well be dependent upon the filesystem type. It is probably worth verifying that before suggesting a fix which itself might break other things (eg. on other filesystems). If you have an SSCCE to illustrate the problem, I'm sure other monks (me included) would be happy to run your test case on other filesystems to see how they behave.


🦛

  • Comment on Re: utf8::downgrade() and file system operators

Replies are listed 'Best First'.
Re^2: utf8::downgrade() and file system operators
by hexcoder (Curate) on Feb 17, 2024 at 11:36 UTC
    Thanks for the sensible suggestion!

    I put an SSCCE together, which produces this output with strawberry-perl v5.38.0 under Windows 10 (default file system type, I guess):

    perl -w .\TestFileOpsWithUTF8_Names.t 1..2 ok 1 - check -f with non-UTF8 file name not ok 2 - check -f with UTF8 file name # Failed test 'check -f with UTF8 file name' # at .\TestFileOpsWithUTF8_Names.t line 18. # Looks like you failed 1 test of 2.

      You forgot to create the file with the other name.
      open my $fh2, q{>}, $fnameUTF8 or die "could not create file $fnameUTF +8:$!"; close $fh2 or die "could not close file $fnameUTF8";

      You might want to unlink it at the end, too.

      map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]