UTF8 Ignore read file errors

This commit is contained in:
fuqingxu
2023-04-12 16:57:01 +08:00
parent 9714d3ea2d
commit c563ac2274
8 changed files with 55 additions and 8 deletions

View File

@@ -44,7 +44,7 @@ def 多文件翻译(file_manifest, project_folder, llm_kwargs, plugin_kwargs, ch
pfg = PaperFileGroup()
for index, fp in enumerate(file_manifest):
with open(fp, 'r', encoding='utf-8') as f:
with open(fp, 'r', encoding='utf-8', errors='replace') as f:
file_content = f.read()
# 定义注释的正则表达式
comment_pattern = r'%.*'