To expand on the point a bit, doing exactly the same spurt/slurp works
with "utf8", but doing it with "utf16" fails to read the text back in:
{
my $unichar_str =# ሀⶀ䷼ꪪⲤⲎ
"\x[1200]\x[2D80]\x[4DFC]\x[]\x[2CA4]\x[2C8E]";
my $file = "/tmp/stuff_in_utf8.txt";
my $fh = $file.
Looking at the documentation for slurp, it looks as though there's a
convenient "enc" option you can use if you're not reading utf8 files.
So I thought this would work:
my $contents = slurp $file, enc => "utf16";
It's not doing what I expected... Raku acts like there's nothing in $contents.
H
I decided to open an issue for this one. Even if there's no practical
fix for the behavior of readchars, I'd think this odd meaning of the
"current" point in the file would need to be better documented:
https://github.com/rakudo/rakudo/issues/3646
I simplified the test I've been using:
use v6
Branch: refs/heads/zag-patch-1
Home: https://github.com/Raku/old-design-docs
Branch: refs/heads/master
Home: https://github.com/Raku/old-design-docs
Commit: 1a90f942619e0d027f9c19228003e20a1997364d
https://github.com/Raku/old-design-docs/commit/1a90f942619e0d027f9c19228003e20a1997364d
Author: Aliaksandr Zahatski
Date: 2020-04-26 (Sun, 26 Apr 2020)
C
Branch: refs/heads/zag-patch-1
Home: https://github.com/Raku/old-design-docs
Commit: 1a90f942619e0d027f9c19228003e20a1997364d
https://github.com/Raku/old-design-docs/commit/1a90f942619e0d027f9c19228003e20a1997364d
Author: Aliaksandr Zahatski
Date: 2020-04-26 (Sun, 26 Apr 2020)