mirror of
https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI.git
synced 2024-12-29 02:55:05 +08:00
feat: fallback to system encoding when fail to read file with utf-8
This commit is contained in:
parent
64b78bed3b
commit
f0dd73a419
@ -278,8 +278,13 @@ def load_wav_to_torch(full_path):
|
||||
|
||||
|
||||
def load_filepaths_and_text(filename, split="|"):
|
||||
with open(filename, encoding="utf-8") as f:
|
||||
filepaths_and_text = [line.strip().split(split) for line in f]
|
||||
try:
|
||||
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
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user