Fix backtick escaping for PowerShell (#16307)

## Summary
Fixes the logic for escaping a double quoted string in PowerShell by not
escaping a backslash but escaping the Unicode double quote variants that
PowerShell treats the same as the ASCII double quotes.

<img width="685" height="99" alt="image"
src="https://github.com/user-attachments/assets/ac1368c2-d915-4e49-b67f-ac71ee0f7d46"
/>

## Test Plan
There does not seem to be any tests for this. I'm fairly new to rust but
happy to add some if someone can point me in the right direction.

---------

Co-authored-by: Aria Desires <aria.desires@gmail.com>
This commit is contained in:
Jordan Borean 2025-10-21 20:16:21 +10:00 committed by GitHub
parent 51e8da2d1c
commit 17155c4cca
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 1 deletions

View File

@ -329,7 +329,9 @@ fn backtick_escape(s: &str) -> String {
let mut escaped = String::with_capacity(s.len());
for c in s.chars() {
match c {
'\\' | '"' | '$' => escaped.push('`'),
// Need to also escape unicode double quotes that PowerShell treats
// as the ASCII double quote.
'"' | '`' | '\u{201C}' | '\u{201D}' | '\u{201E}' | '$' => escaped.push('`'),
_ => {}
}
escaped.push(c);