mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-04-29 12:11:09 +00:00
fix: preserve original encoding when reading/writing non-UTF-8 files
Fixes #2069 - Add iconv-lite dependency for non-UTF-8 encoding support - Add iconvHelper.ts as a CJS/ESM compatibility wrapper - Update readFileWithEncoding() to detect and handle GBK/Big5/Shift_JIS using BOM detection -> UTF-8 validation -> chardet -> iconv-lite fallback - Add detectFileEncoding() to identify file encoding before writes - Update writeTextFile() to accept encoding option and encode with iconv-lite - Update WriteFileTool and EditTool to detect and preserve original encoding - Add tests for GBK read/write, detectFileEncoding, and encoding option
This commit is contained in:
parent
407a66c959
commit
a5eb1733fa
11 changed files with 375 additions and 32 deletions
1
package-lock.json
generated
1
package-lock.json
generated
|
|
@ -19471,6 +19471,7 @@
|
|||
"google-auth-library": "^10.5.0",
|
||||
"html-to-text": "^9.0.5",
|
||||
"https-proxy-agent": "^7.0.6",
|
||||
"iconv-lite": "^0.6.3",
|
||||
"ignore": "^7.0.0",
|
||||
"jsonrepair": "^3.13.0",
|
||||
"marked": "^15.0.12",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue