From 551344e329677c1962d89802485932497e3acf40 Mon Sep 17 00:00:00 2001 From: xunbu Date: Thu, 4 Sep 2025 19:57:44 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=BC=E5=87=BA=E6=9C=AF=E8=AF=AD=E8=A1=A8?= =?UTF-8?q?=E4=BD=BF=E7=94=A8utf8-bom=E7=BC=96=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docutranslate/glossary/glossary.py | 4 +++- 更新日志.txt | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/docutranslate/glossary/glossary.py b/docutranslate/glossary/glossary.py index 1669b94..5e675c8 100644 --- a/docutranslate/glossary/glossary.py +++ b/docutranslate/glossary/glossary.py @@ -35,4 +35,6 @@ class Glossary: writer = csv.writer(content, delimiter=delimiter) writer.writerow(['src', 'dst']) writer.writerows(csv_rows) - return Document.from_bytes(content=content.getvalue().encode("utf-8"), suffix=".csv", stem=stem) + bom = '\ufeff' + content_with_bom = bom + content.getvalue() + return Document.from_bytes(content=content_with_bom.encode("utf-8"), suffix=".csv", stem=stem) diff --git a/更新日志.txt b/更新日志.txt index 6c411e1..aaaddec 100644 --- a/更新日志.txt +++ b/更新日志.txt @@ -5,6 +5,7 @@ v1.4.0版 2025.9.4 - 更全面的异常处理机制和更少出现的漏翻 优化 - 优化提示词 +- 生成术语表使用UTF8-BOM编码 修复 - 修复API文档错误示例 接口变化