You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[FEATURE]:Support file encoding parameter (e.g. GBK) in edit/write tools #37602
I have verified this feature I'm about to request hasn't been suggested before.
Describe the enhancement you want to request
Problem
The built-in edit and write tools always output files in UTF-8 encoding. This is problematic when working with legacy Chinese text files encoded in GBK (or other non-UTF-8 encodings like Shift-JIS, EUC-KR, etc.).
Currently, the only workaround is to run a post-processing command (e.g. iconv / Set-Content -Encoding Default) after every edit, which is cumbersome and error-prone.
Expected behavior
Add an optional encoding parameter to the edit and write tools so users can specify the desired output encoding, for example: { "filePath": "foo.txt", "oldString": "你好", "newString": "世界", "encoding": "gbk" }
The default should remain utf-8 to preserve backward compatibility.
Why this matters
GBK is still widely used in mainland China for legacy systems, government platforms, and embedded device logs.
Many developers working with Chinese text files need to produce GBK output while using opencode's editing capabilities.
A file-level encoding parameter eliminates fragile post-processing steps and makes the editing workflow seamless.
Suggested approach
Add a fileEncoding or encoding field (type: string) to the tool parameters.
Accept values like "utf-8", "gbk", "gb2312", "shift-jis", etc., using Node.js's iconv-lite or the native Encoding API.
Default to "utf-8" when the field is absent.
Related
PRs implementing iconv-lite or similar would likely be small and self-contained.
Happy to contribute if the direction is agreed upon.
Activity
github-actions commentedon Jul 18, 2026
This issue might be a duplicate of existing issues. Please check:
If your request is covered by one of these, consider adding a comment or reaction there instead.
github-actions commentedon Oct 18, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.