encoding problem #4819

Open
opened 2026-02-16 17:45:34 -05:00 by yindo · 4 comments
Owner

Originally created by @kiroskim on GitHub (Jan 12, 2026).

Originally assigned to: @rekram1-node on GitHub.

Description

I am currently facing an issue with encoding when using OpenCode. The original code is encoded in EUC-KR, but the generated code is in UTF-8. As a result, any Korean text in the original code becomes corrupted.

Could you please provide guidance or suggest a solution to ensure proper encoding and avoid this issue?

Thank you in advance for your help. I look forward to your response.

Best regards,

Plugins

No response

OpenCode version

1.1.13

Steps to reproduce

No response

Screenshot and/or share link

No response

Operating System

No response

Terminal

No response

Originally created by @kiroskim on GitHub (Jan 12, 2026). Originally assigned to: @rekram1-node on GitHub. ### Description I am currently facing an issue with encoding when using OpenCode. The original code is encoded in EUC-KR, but the generated code is in UTF-8. As a result, any Korean text in the original code becomes corrupted. Could you please provide guidance or suggest a solution to ensure proper encoding and avoid this issue? Thank you in advance for your help. I look forward to your response. Best regards, ### Plugins _No response_ ### OpenCode version 1.1.13 ### Steps to reproduce _No response_ ### Screenshot and/or share link _No response_ ### Operating System _No response_ ### Terminal _No response_
yindo added the bug label 2026-02-16 17:45:34 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Jan 12, 2026):

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

  • #7891: OpenCode TUI Chinese Text Display Issue (similar encoding/display problem in version 1.1.13)
  • #3493: Korean (Hangul) characters display as broken/garbled in input field
  • #2013: Korean characters disappear in the input prompt when using WezTerm/Ghostty
  • #6950: Enter submits on IME composition confirm, preventing Japanese input
  • #3734: CJK characters break some features like @ mentions (Unicode offset issues)
  • #6921: WebUI fails with non-ASCII directory names (encoding issue with non-ASCII text)
  • #3260: Language environment UI display issues (non-ASCII character handling)
  • #2920: TUI editor hides some double-byte characters in the input field

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Jan 12, 2026): This issue might be a duplicate of existing issues. Please check: - #7891: OpenCode TUI Chinese Text Display Issue (similar encoding/display problem in version 1.1.13) - #3493: Korean (Hangul) characters display as broken/garbled in input field - #2013: Korean characters disappear in the input prompt when using WezTerm/Ghostty - #6950: Enter submits on IME composition confirm, preventing Japanese input - #3734: CJK characters break some features like `@` mentions (Unicode offset issues) - #6921: WebUI fails with non-ASCII directory names (encoding issue with non-ASCII text) - #3260: Language environment UI display issues (non-ASCII character handling) - #2920: TUI editor hides some double-byte characters in the input field Feel free to ignore if none of these address your specific case.
Author
Owner

@kiroskim commented on GitHub (Jan 13, 2026):

The issue is not that Korean characters are broken in the TUI.
The problem is that Korean text inside code files edited or written by opencode gets corrupted.

Looking at the opencode source code on GitHub, it appears that files are read and written using Bun.
Since no encoding is specified, it defaults to UTF-8.

However, our existing code files are encoded in EUC-KR.
As a result, when Bun reads and writes these files using UTF-8, the Korean characters become corrupted.

This is not a TUI-related rendering issue.

@kiroskim commented on GitHub (Jan 13, 2026): The issue is not that Korean characters are broken in the TUI. The problem is that Korean text inside code files edited or written by opencode gets corrupted. Looking at the opencode source code on GitHub, it appears that files are read and written using Bun. Since no encoding is specified, it defaults to UTF-8. However, our existing code files are encoded in EUC-KR. As a result, when Bun reads and writes these files using UTF-8, the Korean characters become corrupted. This is not a TUI-related rendering issue.
Author
Owner

@renanfranca commented on GitHub (Jan 22, 2026):

I am interested in that feature too. In my case, I am working on a project encoded with ISO-8859-1. Every time a file is edited, it transforms the file into UTF-8. I tried to turn the formatter option to false (https://opencode.ai/docs/formatters/#disabling-formatters)

@renanfranca commented on GitHub (Jan 22, 2026): I am interested in that feature too. In my case, I am working on a project encoded with `ISO-8859-1`. Every time a file is edited, it transforms the file into `UTF-8`. I tried to turn the formatter option to `false` (https://opencode.ai/docs/formatters/#disabling-formatters)
Author
Owner

@dardael commented on GitHub (Jan 27, 2026):

I'm also interessed by this feature. I have to work with files encoded in iso-8859-1 and actually every time opencode edit a file it write it in utf8. Looking in tools we see utf8 is used by default by bun, but it will be cool to write and read files using the current file encoding
,

@dardael commented on GitHub (Jan 27, 2026): I'm also interessed by this feature. I have to work with files encoded in iso-8859-1 and actually every time opencode edit a file it write it in utf8. Looking in tools we see utf8 is used by default by bun, but it will be cool to write and read files using the current file encoding ,
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#4819