Skip to content

Read tool displays garbled text for GBK encoded files #31604

Closed as not planned
Closed as not planned

Description

@Gekui126

Description

Description

The Read tool cannot correctly display files encoded in GBK (codepage 936). It shows garbled text (乱码) instead of the actual content.

Steps to Reproduce

  1. Create a text file with GBK encoding (common in .NET applications on Chinese Windows)
  2. Open the file using the Read tool
  3. Observe garbled output

Expected Behavior

The Read tool should auto-detect the file encoding or at least handle common encodings like GBK correctly.

Actual Behavior

The Read tool appears to use UTF-8 by default, causing GBK encoded files to display as garbled text.

Workaround

Using PowerShell with explicit encoding works:

[System.IO.File]::ReadAllText($path, [System.Text.Encoding]::GetEncoding(936))

### Plugins

_No response_

### OpenCode version

1.17.0

### Steps to reproduce

_No response_

### Screenshot and/or share link

_No response_

### Operating System

_No response_

### Terminal

_No response_

Activity

  1. github-actions commented on Jun 10, 2026

    @github-actions
    Contributor

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

    If your issue is distinct from the above, please clarify what makes it different.

  2. github-actions commented on Aug 10, 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