fix(cli): prevent double BOM when content starts with U+FEFF

Strip a leading U+FEFF from text before prepending a UTF-8/UTF-16 BOM so
round-tripping content that already carries a BOM character emits exactly
one BOM. Also clarifies the changeset that new files default to UTF-8.
This commit is contained in:
kiloconnect[bot]
2026-04-23 10:04:01 +00:00
parent e84ea3afc6
commit eb52bda015
3 changed files with 37 additions and 5 deletions
+1 -1
View File
@@ -2,7 +2,7 @@
"@kilocode/cli": minor
---
The agent now detects and preserves the original text encoding of files when reading and editing them, so non-UTF-8 files are displayed correctly to the model and written back in their original encoding.
The agent now detects and preserves the original text encoding of files when reading and editing them, so non-UTF-8 files are displayed correctly to the model and written back in their original encoding. New files are still created as UTF-8 without BOM — detection only applies when overwriting or editing an existing file.
Supported: UTF-8 (with or without BOM), UTF-16 with BOM, and common legacy Latin and CJK encodings (Shift_JIS, EUC-JP, GB2312, Big5, EUC-KR, Windows-1251, KOI8-R, ISO-8859, and others).