Input encoding : accepting UTF-8


I need to get output of native application under PowerShell. The problem is, output is encoded with UTF-8 (no BOM), which PowerShell does not recognize and just converts those funky UTF chars directly into Unicode.

I’ve found PowerShell has $OutputEncoding variable, but it does not seem to affect input data.

Good ol’ iconv is of no help either, since this unnecessary UTF8-as-if-ASCII => Unicode conversion takes place before the next pipeline member acquires data.


I see the issue now with the program below (stdout.cpp – cl stdout.cpp):

And running that through | Out-File -enc UTF8 foo.txt gives the gibberish:

Note that fhex is a PSCX utility.

UPDATE: Figured out how to get this to work:


Input encoding : accepting UTF-8 by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply