#2661 UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe9 in position 723: invalid continuation byte

18.166* Posted at: 9 hours ago 👁8

Traceback (most recent call last):
File "videotrans\winform\fn_fanyisrt.py", line 153, in fanyi_start_fun
File "pathlib.py", line 1133, in read_text
File "codecs.py", line 322, in decode
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe9 in position 723: invalid continuation byte


=
system:Windows-10-10.0.26100-SP0
version:v3.92
frozen:True
language:zh
root_dir:L:/BaiduNetdiskDownload/win-pyvideotrans-v3.92

1 Replies

这个错误表明在翻译字幕文件时,软件尝试用 UTF-8 编码读取文件,但文件内部包含无法解码的字节(0xe9),导致解码失败。这通常是因为字幕文件(SRT/TXT)的编码格式不是标准的 UTF-8,而是 GBK、GB2312 或 ANSI 等编码。

核心解决方法:将字幕文件转换为 UTF-8 编码。

请按以下步骤操作:

  1. 定位并备份字幕文件:找到您要翻译的那个 SRT 或 TXT 字幕文件。
  2. 使用记事本转换编码

    • 右键点击该字幕文件,选择“打开方式” -> “记事本”。
    • 在记事本中,点击菜单栏的 “文件” -> “另存为”
    • 在“另存为”对话框的底部,找到 “编码” 下拉菜单。
    • 将编码从默认的 “ANSI”“GB2312” 改为 “UTF-8”
    • 点击“保存”。(如果提示覆盖,请确认覆盖原文件,或先保存一个新文件再替换)。
  3. 重新尝试翻译:回到 pyVideoTrans 软件,重新选择这个已转换为 UTF-8 编码的字幕文件进行翻译。

如果问题依旧,请检查字幕文件内容是否包含其他特殊或损坏的字符。您也可以尝试使用更专业的文本编辑器(如 Notepad++、VS Code)进行编码转换和检查。

请查看更多参考文档:

Post Your Reply
Open source and free maintenance is not easy. If this project is helpful to you, please consider making a small donation to help the project continue to maintain and update.

Donate: https://ko-fi.com/jianchang512

Trending Questions