1
0
mirror of https://github.com/fumiama/Retrieval-based-Voice-Conversion-WebUI.git synced 2026-06-05 01:10:22 +08:00

feat: fallback to system encoding when fail to read file with utf-8

This commit is contained in:
多玩幻灵qwq
2024-06-09 00:05:12 +08:00
committed by 源文雨
parent 62e6e598ae
commit 2ce493e07c

View File

@@ -250,8 +250,13 @@ def load_wav_to_torch(full_path):
def load_filepaths_and_text(filename, split="|"): def load_filepaths_and_text(filename, split="|"):
with open(filename, encoding="utf-8") as f: try:
filepaths_and_text = [line.strip().split(split) for line in f] with open(filename, encoding="utf-8") as f:
filepaths_and_text = [line.strip().split(split) for line in f]
except UnicodeDecodeError:
with open(filename) as f:
filepaths_and_text = [line.strip().split(split) for line in f]
return filepaths_and_text return filepaths_and_text