Skip to content

[Bug] Garbled CJK characters in OpenCode console due to Windows system default ACP (GBK/CP936) encoding #31187

Closed as not planned

Description

@Thalynor

Description

Environment

  • OS: Windows 11 (Simplified Chinese edition)
  • Shell: PowerShell 7
  • System active code page: 936 (GBK)

Problem Description

The OpenCode console inherits the system's default Active Code Page (ACP) encoding in Windows. On Simplified Chinese versions of Windows, the default system ACP is 936 (GBK). New child processes created by OpenCode inherit this encoding setting for standard input and output streams.

When a command-line tool (or child process) outputs text encoded in UTF-8, the parent OpenCode console reads these UTF-8 bytes using the system's default GBK decoder, resulting in garbled characters (mojibake). This issue primarily affects CJK (Chinese/Japanese/Korean) characters, while pure ASCII characters display normally.
the console output: CJK characters are rendered as garbled symbols, while English/ASCII text is displayed correctly.

Root Cause

  • The child process's standard output is encoded in UTF-8.
  • The parent OpenCode console uses the system's default GBK (CP936) decoder to interpret the UTF-8 byte stream, causing misinterpretation of multi-byte CJK characters.

Plugins

none

OpenCode version

1.15.13

Steps to reproduce

  1. Run OpenCode in a Simplified Chinese Windows 11 environment with PowerShell 7.
  2. Execute a script/command that outputs UTF-8 encoded text containing CJK characters (e.g., the PowerShell script in the screenshot reading UTF-8 text files).
  3. Observe the console output: CJK characters are rendered as garbled symbols, while English/ASCII text is displayed correctly.

Screenshot and/or share link

Image

Operating System

Windows 11

Terminal

Windows Terminal, powershell 7

Activity

  1. github-actions commented on Jun 7, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    If your issue is distinct from all of the above, please clarify how it differs. Otherwise, consider adding your context to one of the existing issues.

  2. github-actions commented on Aug 7, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions