Skip to content

Commit bbcaf5a

Browse files
committed
Ensure chcp call only happens on Windows
Part of microsoft#251478
1 parent 2fabac4 commit bbcaf5a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/vs/platform/shell/node/shellEnv.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,12 @@ async function doResolveShellEnv(logService: ILogService, token: CancellationTok
139139
// Older versions of PowerShell removes double quotes sometimes
140140
// so we use "double single quotes" which is how you escape single
141141
// quotes inside of a single quoted string.
142-
command = `chcp 65001; Write-Output '${mark}'; [System.Environment]::GetEnvironmentVariables() | ConvertTo-Json -Compress; Write-Output '${mark}'`;
142+
command = `Write-Output '${mark}'; [System.Environment]::GetEnvironmentVariables() | ConvertTo-Json -Compress; Write-Output '${mark}'`;
143+
144+
// Improve unicode support on Windows by setting the code page to UTF-8
145+
if (isWindows) {
146+
command = `chcp 65001; ${command}`;
147+
}
143148

144149
// -Login is not a supported argument on PowerShell 5, which is a version of
145150
// powershell that is exclusive to Windows. Providing it would error. Also,

0 commit comments

Comments
 (0)