mirror of
https://github.com/rany2/edge-tts
synced 2024-11-21 17:29:07 +00:00
Unicode considers newlines as control characters... oops
This commit is contained in:
parent
465f5cdb0f
commit
185db5fe1c
12
edge-tts.py
12
edge-tts.py
@ -23,7 +23,17 @@ def terminator(signo, stack_frame): sys.exit()
|
||||
signal.signal(signal.SIGINT, terminator)
|
||||
signal.signal(signal.SIGTERM, terminator)
|
||||
def connectId(): return str(uuid.uuid4()).replace("-", "")
|
||||
def removeIncompatibleControlChars(s): return "".join(ch for ch in s if unicodedata.category(ch)[0]!="C")
|
||||
def removeIncompatibleControlChars(s):
|
||||
output = []
|
||||
for ch in s:
|
||||
# We consider these control characters as whitespace
|
||||
if ch in ['\t','\n','\r']:
|
||||
pass
|
||||
else:
|
||||
abr = unicodedata.category(ch)
|
||||
if abr.startswith("C"): continue
|
||||
output += [ ch ]
|
||||
return "".join(output)
|
||||
|
||||
def list_voices():
|
||||
with urllib.request.urlopen(voiceList) as url:
|
||||
|
Loading…
Reference in New Issue
Block a user