in reply to Re^4: Unicode issues with emc uemcli
in thread Unicode issues with emc uemcli

Simpler:

open (my $fh2, '>:encoding(UTF-16)', $textfile2)

Replies are listed 'Best First'.
Re^6: Unicode issues with emc uemcli
by haukex (Archbishop) on Sep 08, 2020 at 06:52 UTC
    open (my $fh2, '+>', $textfile2) or die "Cannot open file.$!"; my $str2 = decode('UTF-16', $out2, Encode::FB_CROAK); print $fh2 $str2;
    Simpler: open (my $fh2, '>:encoding(UTF-16)', $textfile2)

    No, it seems you misread decode as encode.