Hugging Face
Models
Datasets
Spaces
Posts
Docs
Solutions
Pricing
Log In
Sign Up
Spaces:
NATSpeech
/
PortaSpeech
like
31
Runtime error
App
Files
Files
Community
e75aa39
PortaSpeech
/
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