AudioGPT / text_to_speech /utils /text /encoding.py
z11h's picture
Duplicate from AIGC-Audio/AudioGPT
5dacb9f
Raw
History Blame Contribute Delete
207 Bytes
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