Skip to content

Conversation

@dylan-hurd-oai
Copy link
Collaborator

@dylan-hurd-oai dylan-hurd-oai commented Dec 12, 2025

Summary

Adds a FeatureFlag to enforce UTF8 encoding in powershell, particularly Windows Powershell v5. This should help address issues like #7290.

Notably, this PR does not include the ability to parse apply_patch invocations within UTF8 shell commands (calls to the freeform tool should not be impacted). I am leaving this out of scope for now. We should address before this feature becomes Stable, but those cases are not the default behavior at this time so we're okay for experimentation phase. We should continue cleaning up the apply_patch::invocation logic and then can handle it more cleanly.

Testing

  • Adds additional testing

@dylan-hurd-oai dylan-hurd-oai force-pushed the dh--powershell--utf-8 branch 2 times, most recently from e5750bd to a623f60 Compare December 12, 2025 23:44
Copy link

@maxj-oai maxj-oai left a comment

Choose a reason for hiding this comment

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

seems reasonable to me

@dylan-hurd-oai dylan-hurd-oai changed the title [wip] fix(windows) start shell in utf-8 mode [wip] fix(windows) start powershell in utf-8 mode Dec 16, 2025
@dylan-hurd-oai dylan-hurd-oai force-pushed the dh--powershell--utf-8 branch 4 times, most recently from e2b078c to 2a24d64 Compare December 18, 2025 18:56
@dylan-hurd-oai dylan-hurd-oai changed the title [wip] fix(windows) start powershell in utf-8 mode feat(windows) start powershell in utf-8 mode Dec 18, 2025
@dylan-hurd-oai dylan-hurd-oai marked this pull request as ready for review December 18, 2025 19:23
@dylan-hurd-oai dylan-hurd-oai force-pushed the dh--powershell--utf-8 branch 2 times, most recently from ae69170 to 77f84e0 Compare December 18, 2025 22:00
Copy link
Collaborator

@jif-oai jif-oai left a comment

Choose a reason for hiding this comment

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

Ok on the principle but a lot of the wiring can be simplified

const POWERSHELL_FLAGS: &[&str] = &["-nologo", "-noprofile", "-command", "-c"];

/// Prefixed command for powershell shell calls to force UTF-8 console output.
pub(crate) const UTF8_OUTPUT_PREFIX: &str =
Copy link
Collaborator

Choose a reason for hiding this comment

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

TIL, I would never have guesses that this is sufficient.


/// Prefixed command for powershell shell calls to force UTF-8 console output.
pub(crate) const UTF8_OUTPUT_PREFIX: &str =
"[Console]::OutputEncoding=[System.Text.Encoding]::UTF8;\n";
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is it stable for every windows version?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants