- Notifications
You must be signed in to change notification settings - Fork33.8k
fix: PowerShell not working with username having Unicode#251534
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Conversation
@Tyriar, could you please take a look at this fix? Thanks! |
480485f
intomicrosoft:mainUh oh!
There was an error while loading.Please reload this page.
@@ -139,7 +139,7 @@ async function doResolveShellEnv(logService: ILogService, token: CancellationTok | |||
// Older versions of PowerShell removes double quotes sometimes | |||
// so we use "double single quotes" which is how you escape single | |||
// quotes inside of a single quoted string. | |||
command = `Write-Output '${mark}'; [System.Environment]::GetEnvironmentVariables() | ConvertTo-Json -Compress; Write-Output '${mark}'`; | |||
command = `chcp 65001;Write-Output '${mark}'; [System.Environment]::GetEnvironmentVariables() | ConvertTo-Json -Compress; Write-Output '${mark}'`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
...wait does this run on macOS & Linux as well with PowerShell 7+? If sochcp
is not available there and this will break.
liuxingbaoyuJun 16, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Oops, I testedchcp
and it doesn't work on linux.
I noticed@Tyriar already fixed it, thanks!
Fixes#251478
On some computers, the default encoding of PowerShell is not utf8, which will cause the Unicode characters in the obtained environment variables to become garbled. Here we first set the encoding to utf8 to fix this issue.