Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Re^9: unpacking wmic command's unicode output

by goibhniu (Hermit)
on Nov 12, 2008 at 21:19 UTC ( #723293=note: print w/replies, xml ) Need Help??

in reply to Re^8: unpacking wmic command's unicode output
in thread unpacking wmic command's unicode output

but that's not -CS's fault, as it prints 6 without -CS as well. Or am I missing something still?

#my sig used to say 'I humbly seek wisdom. '. Now it says:
use strict;
use warnings;
I humbly seek wisdom.
  • Comment on Re^9: unpacking wmic command's unicode output

Replies are listed 'Best First'.
Re^10: unpacking wmic command's unicode output
by ikegami (Pope) on Nov 12, 2008 at 21:26 UTC

    Ok, I'll cede that while it has an effect (data from STDIN should be considered decoded), saying it's harmful is incorrect.

    However, it doesn't fix the problem it's suppose to fix. As a solution, it's useless and therefore wrong.

      As a solution, it's useless and therefore wrong.

      Hm. That's a bit strong. As a solution, it produces the desired result. Ie. The data in the file is sans unicoding.

      The fact that the -CS isn't actually responsible for that--nor even perl itself directly--doesn't detract from the usability of the solution to produce desired result.

      As it turns out, wmic process | perl -pe1 > file also produces the desired result, and as its 3 characters shorter I guess that makes it a superiour solution. I would have suggested that; had I thought to have tried it.

      It turns out that it just going via a pipe that causes wmic.exe to produce ansi output rather than unicode, so a simple wmic process | tee > file works.

      And it's even shorter.

      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.
        I suspect that wmic always outputs the same thing, but that tee uses ReadFileA forcing a recoding to "ANSI".
        Why does Perl leave double CRs?
        C:>wmic diskdrive where "model = 'HGST HTS725050A7E630 ATA Device'" ge +t index | perl -pe1 >x3.txt 8:54:20.49 C:\Users\pwatson C:>odd x3.txt 000000 49 6e 64 65 78 20 20 0d 0d 0a +30 20 20 20 20 20 I n d e x \r \r \n 0 000010 20 0d 0d 0a 0d 0d 0a \r \r \n \r \r \n

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://723293]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (9)
As of 2018-10-22 12:02 GMT
Find Nodes?
    Voting Booth?
    When I need money for a bigger acquisition, I usually ...

    Results (119 votes). Check out past polls.

    • (Sep 10, 2018 at 22:53 UTC) Welcome new users!