develooper Front page | perl.perl6.users | Postings from May 2020

slurp with enc("utf16") doesn't work

From:
Joseph Brenner
Date:
May 13, 2020 20:58
Subject:
slurp with enc("utf16") doesn't work
Message ID:
CAFfgvXWktK16g2V0evPUyxTk8Rr83XpugAg+9sKqJj6QL5q2yQ@mail.gmail.com
I just got to look into this one again a little further, and it does seem that
reading a utf16 file like this doesn't work:

      my $contents = slurp( $file, :enc("utf16") );

Though this, however, does work:

      my $fh = $file.IO.open( :r, :enc("utf16") );
      my $contents = $fh.slurp;

Also the routine form (as opposed to the method form) of slurp works
with other encodings like utf8 and latin1.

So I'm opening an issue for this on github:
https://github.com/rakudo/rakudo/issues/3691



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About