mirror of
https://github.com/AIGC-Audio/AudioGPT.git
synced 2026-07-10 20:40:45 +02:00
10 lines
207 B
Python
10 lines
207 B
Python
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
|