PowerShell ISE v4/v3 doesn't handle stdout from children using the same charset conversion as the console host
Votes from Connect: 3
Original Date Submitted: 7/22/2014 4:37:07 PM
Site Name: PowerShell
Feedback ID: 926280
Frequency: Always Happens
Regression: Yes, this happens in previous released versions
Suppose I'm reading the output of some child command using
$foo = $(& "something.exe")
If the child's stdout contains accented characters, the PowerShell console host apparently (undocumentedly?) does an implicit conversion from the "IBM437" encoding to "windows-1252" encoding.
The PowerShell ISE, however, does something different, breaking some scripts / making it impossible to get the same results in the console host and in the ISE. For instance if the child outputs an IBM437 "é" (130 decimal) then $foo will contain a "single Low-9 Quotation Mark" (U+201A) instead of the expected U+00E9.
We need to be able to write code that works the same in both ISE (for dev/debugging) and console host (where the code runs).
Product Studio item created by Connect Synchronizer due to creation of feedback ID 926280 (http://connect.microsoft.com/PowerShell/feedback/ViewFeedback.aspx?FeedbackID=926280).
- compile the following C++ code to an EXE:
void showchar(int x)
printf("This is the char with code %d: '%c'\n", x, x);
int tmain(int argc, TCHAR* argv)
run the EXE as follows:
$foo = $(& E:\tmp\AccentedChars\Debug\AccentedChars.exe)
from ISE you'll get:
like in the powershell.exe console host
Internal BugId: 8905
Stéphane BARIZIEN commented
With PowerShell 5.0.10586.494 on Windows 10 build 10586.589 I get different results: