Skip to content

fix(shell): set utf8 output encoding for powershell#31346

Open
qinant wants to merge 1 commit into
anomalyco:devfrom
qinant:fix/powershell-utf8-output
Open

fix(shell): set utf8 output encoding for powershell#31346
qinant wants to merge 1 commit into
anomalyco:devfrom
qinant:fix/powershell-utf8-output

Conversation

@qinant
Copy link
Copy Markdown

@qinant qinant commented Jun 8, 2026

Issue for this PR

Closes #23636
Closes #31187
Closes #30205

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

PowerShell on Windows can emit shell output using the active console code page, while opencode decodes captured output as UTF-8. This makes Chinese and other non-ASCII output render as mojibake.

This PR wraps PowerShell commands with UTF-8 output encoding setup before running the user command. The wrapper is used by both direct shell execution and the shell tool path.

How did you verify your code works?

  • Manually verified. Input in opencode cli or desktop: use pwsh exec command: Write-Output "测试中文输出".
    If renders correctly in the shell output prove it works. And i have checked it locally.

Screenshots / recordings

before fix this bug, there are mojibake in output:
image
After fix there are no mojibake in output:
image

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label Jun 8, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 8, 2026

The following comment was made by an LLM, it may be inaccurate:

Potential Duplicate Found:

Why it's likely related: This PR (#31297) also addresses PowerShell UTF-8 encoding issues, which is the same core problem being fixed in the current PR (#31346). Both PRs appear to target the same issue (#31345) and apply UTF-8 output encoding configuration to PowerShell shell execution.

@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Jun 8, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 8, 2026

Thanks for updating your PR! It now meets our contributing guidelines. 👍

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

Labels

None yet

Projects

None yet

1 participant