导出术语表使用utf8-bom编码

This commit is contained in:
xunbu
2025-09-04 19:57:44 +08:00
parent a3012a9af0
commit 551344e329
2 changed files with 4 additions and 1 deletions

View File

@@ -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)