修复编码问题、允许修改port

This commit is contained in:
xunbu
2025-07-04 19:15:21 +08:00
parent 13abf292a3
commit c3e7e0540f
6 changed files with 38 additions and 27 deletions

View File

@@ -301,7 +301,7 @@ class FileTranslater:
if embeded:
output_dir.mkdir(parents=True, exist_ok=True)
full_name = output_dir / filename.name
with open(full_name, "w") as file:
with open(full_name, "w", encoding="utf-8") as file:
file.write(self.export_to_markdown())
translater_logger.info(f"文件已写入{full_name.resolve()}")
else:
@@ -336,7 +336,7 @@ class FileTranslater:
output_dir.mkdir(parents=True, exist_ok=True)
full_name = output_dir / filename
html_content = self.export_to_html(title=str(full_name.resolve().stem))
with open(full_name, "w") as file:
with open(full_name, "w",encoding="utf-8") as file:
file.write(html_content)
translater_logger.info(f"文件已写入{full_name.resolve()}")
return self