Skip to content

Commit 91f0eae

Browse files
committed
shellIntegration.ps1: unambiguously escape messages with UTF8
1 parent 4eb054e commit 91f0eae

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/vs/workbench/contrib/terminal/browser/media/shellIntegration.ps1

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,11 @@ function Global:__VSCode-Escape-Value([string]$value) {
2525
if ($match.Value -eq '\') {
2626
'\\'
2727
} else {
28-
# Any other character is encoded as hex.
29-
'\x{0:x2}' -f [int][char]$match.Value
28+
# Any other characters are encoded as their UTF-8 hex values.
29+
-Join (
30+
[System.Text.Encoding]::UTF8.GetBytes($match.Value)
31+
| ForEach-Object { '\x{0:x2}' -f $_ }
32+
)
3033
}
3134
})
3235
}

0 commit comments

Comments
 (0)