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

Hi Haukex,

Yes, it works and perfectly shows the output!! Thank you so much.

All I now how to figure out is how to put this my script so that I get the desired output. Quite frankly I'm not able to make much out of the clever stuff you wrote. You've wrapped the command in what I think is a anonymous aref along with undef, \my $out. Wish there were an easier way to do this, but , that is something for me to figure out. Thank you once again.

Replies are listed 'Best First'.
Re^5: Unicode issues with emc uemcli
by haukex (Archbishop) on Sep 08, 2020 at 06:54 UTC
    You've wrapped the command in what I think is a anonymous aref along with undef, \my $out.

    Yes, all of this is part of the API of IPC::Run3, its documentation explains it. I used an arrayref because this will cause the module to do its best to avoid the shell (which is a slightly complicated topic on Windows, but at least newer versions of the module will use Win32::ShellQuote to help with some of the issues). The undef causes the child process to inherit STDIN from the parent, and \my $out causes the command's STDOUT to be stored in that variable. Then, I use Encode to decode the data from the command, which is encoded in UTF-16LE; note that I specify the encoding to simply be UTF-16 because the module is smart enough to use the BOM that is part of the output you showed.