Revert "feat: 添加 GBK 编码自动检测支持,文件读写工具透明处理非 UTF-8 文件"

This reverts commit 0ce8f7a1cb.
This commit is contained in:
claude-code-best
2026-05-10 22:57:30 +08:00
parent 43c20a43c2
commit aaabf0c168
22 changed files with 120 additions and 1727 deletions

View File

@@ -29,7 +29,6 @@ import { extractClaudeCodeHints } from 'src/utils/claudeCodeHints.js';
import { detectCodeIndexingFromCommand } from 'src/utils/codeIndexing.js';
import { isEnvTruthy } from 'src/utils/envUtils.js';
import { isENOENT, ShellError } from 'src/utils/errors.js';
import { decodeBuffer } from 'src/utils/encoding.js';
import { detectFileEncoding, detectLineEndings, getFileModificationTime, writeTextContent } from 'src/utils/file.js';
import { fileHistoryEnabled, fileHistoryTrackEdit } from 'src/utils/fileHistory.js';
import { truncate } from 'src/utils/format.js';
@@ -512,8 +511,7 @@ async function applySedEdit(
const encoding = detectFileEncoding(absoluteFilePath);
let originalContent: string;
try {
const rawBuffer = await fs.readFileBytes(absoluteFilePath);
originalContent = decodeBuffer(rawBuffer, encoding);
originalContent = await fs.readFile(absoluteFilePath, { encoding });
} catch (e) {
if (isENOENT(e)) {
return {