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

@@ -3,7 +3,6 @@ import React, { Suspense, use, useMemo } from 'react';
import { FileEditToolDiff } from 'src/components/FileEditToolDiff.js';
import { getCwd } from 'src/utils/cwd.js';
import { isENOENT } from 'src/utils/errors.js';
import { decodeBuffer } from 'src/utils/encoding.js';
import { detectEncodingForResolvedPath } from 'src/utils/fileRead.js';
import { getFsImplementation } from 'src/utils/fsOperations.js';
import { Text } from '@anthropic/ink';
@@ -34,10 +33,9 @@ export function SedEditPermissionRequest({ sedInfo, ...props }: SedEditPermissio
// render correctly. This matches what readFileSync did before the
// async conversion.
const encoding = detectEncodingForResolvedPath(filePath);
const rawBuffer = await getFsImplementation().readFileBytes(filePath);
const raw = decodeBuffer(rawBuffer, encoding).replaceAll('\r\n', '\n');
const raw = await getFsImplementation().readFile(filePath, { encoding });
return {
oldContent: raw,
oldContent: raw.replaceAll('\r\n', '\n'),
fileExists: true,
};
})().catch((e: unknown): FileReadResult => {