On Wed, Mar 3, 2010 at 12:51 AM, Alexandr Fedorov via RT
<bug-IO-CaptureOutput@rt.cpan.org> wrote:
Show quoted text> I'm trying to execute windows utility "wmic", if success it's return
> data in utf-16 encoding, in some sort of errors - utf-16 too, and
> sometimes in ANSI encoding.
> When error is going with utf-16 encoding, BOM header in printed to
> STDOUT and all that remains is printed to STDERR. When using qxx sub BOM
> header - don't join to STDERR stream and i can't simply decode that
> string, please repair this.
IO::CaptureOutput is not getting active support these days as I've
been working on a replacement called Capture::Tiny.
Capture::Tiny has some better support for utf, but I don't know if it
will solve your particular problem. Would you mind trying it and
letting me know?
Also, per your other ticket, getting quoting right on Windows is hard.
I suggest you try either IPC::System::Simple or IPC::Cmd and see if
they get it right. Then, with Capture:Tiny, your code would be like
this:
use IPC::System::Simple 'systemx';
use Capture::Tiny 'capture';
my ($output, $error) = capture { systemx($cmd, @args) };
You might also want to read
http://www.perlmonks.org/?node_id=722963
which suggests that piping wmic to another process forces ANSI output,
which might help you.
-- David