Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Support for utf16 and binary IO with 16/32-bit bufs #6674
This little program:
my $fh = open 'test.txt', :w, :enc('utf16');
Gives this error:
filehandle is using utf16
This is Rakudo Star version 2018.01 built on MoarVM version 2018.01
On Fri, 16 Feb 2018 00:56:27 -0800, comdog wrote:
Looks like MoarVM doesn't fully support utf-16 yet (the exception is from MVM_io_read_bytes that just throws unless it's handed a 8-bit buf)
Slightly golfed version:
$ ./perl6 -e '"t.t".IO.open(:w :bin).write: utf16.new: 1, 2, 3'
$ ./perl6 -e '"t.t".IO.open(:w :bin).write: utf32.new: 1, 2, 3'
$ ./perl6 -e '"t.t".IO.open(:w :bin).write: buf32.new: 1, 2, 3'
Dies on read too, but with a more useful message:
$ ./perl6 -e '"LICENSE".IO.open(:enc<utf-16>).slurp.say'
Works fine on JVM backend.