ITADN

[Bug] UnicodeDecodeError in train.py on Windows due to missing utf-8 encoding

#1204Closedadv-dying 创建于 2026-01-15
bug
A
adv-dyingcommented
### Project Version 3.6.0 ### Platform and OS Version Windows11 64-bit ### Affected Devices laptop ### Existing Issues _No response_ ### What happened? ### Description I encountered a `UnicodeDecodeError` when attempting to export/train the model on Windows. This appears to be caused by `json.load()` opening the config file using the system's default encoding (GBK in my case) instead of UTF-8, which fails when the file path or content contains non-ASCII characters (e.g., Chinese characters). ### Environment - **OS:** Windows 11 - **Applio/RVC Version:** [3.6.0] ### Steps to reproduce 1. Run the training/export process on a Windows system with a Chinese locale (or any non-UTF-8 default locale). 2. Have a dataset path or config containing non-ASCII characters. 3. The process crashes with the following error. ### Expected behavior training normally ### Attachments ### Error Log ```text Traceback (most recent call last): File "D:\Applio\rvc\train\train.py", line 81, in <module> config = json.load(f) ^^^^^^^^^^^^ File "D:\Applio\env\Lib\json\__init__.py", line 293, in load return loads(fp.read(), ^^^^^^^^^ UnicodeDecodeError: 'gbk' codec can't decode byte 0xac in position 381: illegal multibyte sequence ``` ### Screenshots or Videos _No response_ ### Additional Information Proposed Fix Explicitly specify encoding='utf-8' when opening the file. File: rvc/train/train.py (Line ~80) Before: Python try: with open(os.path.join(current_dir, "assets", "config.json"), "r") as f: config = json.load(f) After: Python try: with open(os.path.join(current_dir, "assets", "config.json"), "r",encoding='utf-8') as f: config = json.load(f)
关闭于 2026-01-16 0 条评论