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
Edit tool corrupts files with Windows-1252 (non-UTF-8) encoding #28521
The Edit tool reads and writes files assuming UTF-8 text. For codebases encoded in Windows-1252 (common in TOTVS/Protheus ADVPL ecosystem in Brazil), bytes like 0xE7 (ç), 0xE3 (ã), 0xE9 (é) — valid Windows-1252 but invalid UTF-8 sequences — get corrupted on read. On write, the entire file is converted to garbled UTF-8, destroying Portuguese accents and special characters.
Plugins
No response
OpenCode version
1.15.5
Steps to reproduce
Create a file with Windows-1252 encoding containing ç ã é (bytes E7, E3, E9)
If your issue is specifically about the Edit tool corrupting Windows-1252 files (rather than a general feature request for multi-encoding support), it may still be worth keeping open as a distinct bug report with a concrete reproduction case.
Thought how such encoding issues are handled elsewhere. From java tools we know a runtime setting which determines, which encoding the tool should use when processing text files. Assuming that for most codebases the encoding of text files is determined equally by convention, a setting of which encoding opencode should use could help. In Java the runtime setting is file.encoding="UTF-8"
Activity
github-actions commentedon May 20, 2026
This issue might be a duplicate of existing issues. Please check:
If your issue is specifically about the Edit tool corrupting Windows-1252 files (rather than a general feature request for multi-encoding support), it may still be worth keeping open as a distinct bug report with a concrete reproduction case.
majick commentedon May 22, 2026
Cheap hack to make
editless dangerous: scold the model for calling it until it stops destroying ~70% of the files it touches.approx line 70 of
opencode-dev/packages/opencode/src/tool/edit.ts. See for detail: #24742 (comment)aburghacc commentedon Jun 24, 2026
same problem here.
Thought how such encoding issues are handled elsewhere. From java tools we know a runtime setting which determines, which encoding the tool should use when processing text files. Assuming that for most codebases the encoding of text files is determined equally by convention, a setting of which encoding opencode should use could help. In Java the runtime setting is file.encoding="UTF-8"
github-actions commentedon Aug 24, 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.