PowerShell in Unicode, Windows 8 RP and Windows Server 2012 RC

PowerShell 3.0 under Windows 8

I was testing our software with latest version of Microsoft Windows — Windows 8 Release Preview and Windows Server 2012 Release Candidate (Windows Server 2012 RC Datacenter).

There was some changed behavior in very specific cases for some rarely used Windows API. I also found some race conditions, that showed up in Windows 8, but all this was trivial to fix.

The strange problem appeared in capturing console output from PowerShell in UTF-8 or Unicode (UTF-16). We are using CreateProcess Windows API function with redirected pipes. And strangely all output is converted from Unicode to ASCII. We are using OutputEncoding UTF-8:
[Console]::OutputEncoding = [Text.Encoding]::Utf8See example here: Unicode in PowerShell – example #2.

Windows 8 is using a new version of PowerShell — v3, so I tried to use compatibility command line switch -version 2.0, and this solved the problem.

Most probably this is a bug in Microsoft PowerShell — PowerShell somewhere is converting all output to ASCII. The question remains, will this be fixed in RTM or we will be unable to use Unicode output in PowerShell v3.

P.S. Currently I am unable to test this under Windows 8 RTM or Windows Server 2012 RTM, because for MSDN subscribers, Windows 8 and 2012 will be available on August 15, 2012.

2 replies on “PowerShell in Unicode, Windows 8 RP and Windows Server 2012 RC”

  1. I just got the same issue of Windows 8 RTM up to date (1st of July 2013) !
    I wonder if it is fixed in 8.1 !
    Did you report it to MS?

Comments are closed.