Files
SoulX-Singer/preprocess/tools/note_transcription/utils/text/encoding.py
T

10 lines
207 B
Python
Raw Normal View History

2026-02-06 20:31:14 +08:00
import chardet
def get_encoding(file):
with open(file, 'rb') as f:
encoding = chardet.detect(f.read())['encoding']
if encoding == 'GB2312':
encoding = 'GB18030'
return encoding