Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for utf16 and binary IO with 16/32-bit bufs #6674

Open
p6rt opened this issue Feb 16, 2018 · 3 comments
Open

Support for utf16 and binary IO with 16/32-bit bufs #6674

p6rt opened this issue Feb 16, 2018 · 3 comments
Labels

Comments

@p6rt
Copy link

@p6rt p6rt commented Feb 16, 2018

Migrated from rt.perl.org#132874 (status was 'open')

Searchable as RT132874$

@p6rt

This comment has been minimized.

Copy link
Author

@p6rt p6rt commented Feb 16, 2018

From @briandfoy

This little program​:

  my $fh = open 'test.txt', :w, :enc('utf16');
  put "filehandle is using {$fh.encoding}";
  $fh.put​: 'Some text';

Gives this error​:

  filehandle is using utf16
  write_fhb requires a native array of uint8 or int8


This is Rakudo Star version 2018.01 built on MoarVM version 2018.01
implementing Perl 6.c

@p6rt

This comment has been minimized.

Copy link
Author

@p6rt p6rt commented Feb 16, 2018

From @zoffixznet

On Fri, 16 Feb 2018 00​:56​:27 -0800, comdog wrote​:

This little program​:

my $fh = open 'test\.txt', :w, :enc\('utf16'\);
put "filehandle is using \{$fh\.encoding\}";
$fh\.put​: 'Some text';

Gives this error​:

filehandle is using utf16
write\_fhb requires a native array of uint8 or int8

----
This is Rakudo Star version 2018.01 built on MoarVM version 2018.01
implementing Perl 6.c

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'
  write_fhb requires a native array of uint8 or int8
  in block <unit> at -e line 1

  $ ./perl6 -e '"t.t".IO.open(​:w :bin).write​: utf32.new​: 1, 2, 3'
  write_fhb requires a native array of uint8 or int8
  in block <unit> at -e line 1

  $ ./perl6 -e '"t.t".IO.open(​:w :bin).write​: buf32.new​: 1, 2, 3'
  write_fhb requires a native array of uint8 or int8
  in block <unit> at -e line 1

Dies on read too, but with a more useful message​:

  $ ./perl6 -e '"LICENSE".IO.open(​:enc<utf-16>).slurp.say'
  Streaming decode NYI for encoding 4
  in block <unit> at -e line 1

Works fine on JVM backend.

@p6rt

This comment has been minimized.

Copy link
Author

@p6rt p6rt commented Feb 16, 2018

The RT System itself - Status changed from 'new' to 'open'

@p6rt p6rt added moar NYI labels Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.