Hugging Face
Models
Datasets
Spaces
Posts
Docs
Solutions
Pricing
Log In
Sign Up
Spaces:
NATSpeech
/
DiffSpeech
like
46
Runtime error
App
Files
Files
Community
3c16657
DiffSpeech
/
utils
/
text
/
encoding.py
RayeRen
init
d1b91e7
almost 3 years ago
raw
Copy download link
history
blame
Safe
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