-
Notifications
You must be signed in to change notification settings - Fork 6.4k
fix: UTF-8 encoding in PowerShell commands for Turkish #4315
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: UTF-8 encoding in PowerShell commands for Turkish #4315
Conversation
…er support - Add UTF-8 console output encoding setup to all PowerShell command execution paths - Prepend [Console]::OutputEncoding = [System.Text.Encoding]::UTF8 to PowerShell commands - Update tests to reflect new command format with encoding setup - Fixes issue where Turkish characters (çğıİöşü) were corrupted in console output Fixes openai#4131 Signed-off-by: Chenyang Li <[email protected]>
|
All contributors have signed the CLA ✍️ ✅ |
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.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
|
I have read the CLA Document and I hereby sign the CLA |
The previous implementation incorrectly assumed -Command was always at index 1. Signed-off-by: Chenyang Li <[email protected]>
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.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
- Add special case handling for '-' stdin sentinel in PowerShell commands - Prevent UTF-8 encoding prefix from breaking 'pwsh -Command -' pattern - Add comprehensive test case for stdin functionality - Addresses bot review feedback from PR openai#4315 Signed-off-by: Chenyang Li <[email protected]>
|
@codex review |
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.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
|
@codex review |
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.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
|
@codex review |
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.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
| if cmd_arg.trim_start().starts_with("--%") { | ||
| // Insert -OutputEncoding utf8 before -Command | ||
| modified_command.insert(command_index, "-OutputEncoding".to_string()); | ||
| modified_command.insert(command_index + 1, "utf8".to_string()); | ||
| return Some(modified_command); |
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.
Avoid unsupported
-OutputEncoding parameter for stop-parsing commands
The stop-parsing branch prepends -OutputEncoding utf8 before -Command when the argument starts with --%. Neither pwsh.exe nor powershell.exe accepts a -OutputEncoding switch, so any command using --% will now fail before the script runs. This is a regression for commands that relied on --% to pass raw arguments (e.g., pwsh.exe -NoProfile -Command --% git …). Consider another way to set UTF‑8 output, such as adjusting [Console]::OutputEncoding without introducing an invalid parameter.
Useful? React with 👍 / 👎.
What?
Fixed Turkish character encoding issue in PowerShell commands
Added UTF-8 console output encoding to prevent character corruption
Why?
Turkish characters (çğıİöşü) were being corrupted in PowerShell output
PowerShell was using system default encoding instead of UTF-8
Issue reported in #4131
How?
Modified codex-rs/core/src/shell.rs to prepend UTF-8 encoding setup to PowerShell commands
Updated all PowerShell execution paths to use [Console]::OutputEncoding = [System.Text.Encoding]::UTF8
Updated tests to match new command format