Skip to content

Conversation

@ChenyangLi4288
Copy link

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

…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]>
@github-actions
Copy link

github-actions bot commented Sep 26, 2025

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@ChenyangLi4288 ChenyangLi4288 marked this pull request as draft September 26, 2025 19:41
Copy link
Contributor

@chatgpt-codex-connector chatgpt-codex-connector bot left a 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 👍.

@ChenyangLi4288
Copy link
Author

I have read the CLA Document and I hereby sign the CLA

github-actions bot added a commit that referenced this pull request Sep 26, 2025
The previous implementation incorrectly assumed -Command was always at index 1.

Signed-off-by: Chenyang Li <[email protected]>
@ChenyangLi4288 ChenyangLi4288 marked this pull request as ready for review September 26, 2025 19:53
Copy link
Contributor

@chatgpt-codex-connector chatgpt-codex-connector bot left a 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]>
ChenyangLi4288

This comment was marked as resolved.

@ChenyangLi4288
Copy link
Author

@codex review

Copy link
Contributor

@chatgpt-codex-connector chatgpt-codex-connector bot left a 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 👍.

@ChenyangLi4288
Copy link
Author

@codex review

Copy link
Contributor

@chatgpt-codex-connector chatgpt-codex-connector bot left a 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 👍.

@ChenyangLi4288
Copy link
Author

@codex review

Copy link
Contributor

@chatgpt-codex-connector chatgpt-codex-connector bot left a 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 👍.

Comment on lines +105 to +109
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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

@github-actions github-actions bot locked and limited conversation to collaborators Oct 13, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant