mirror of
https://github.com/morpheus65535/bazarr
synced 2024-12-27 01:57:33 +00:00
Merge pull request #888 from josdion/development
Fix subtitle character encoding detection
This commit is contained in:
commit
92497a8822
1 changed files with 2 additions and 2 deletions
|
@ -378,8 +378,8 @@ def guess_external_subtitles(dest_folder, subtitles):
|
||||||
text = f.read()
|
text = f.read()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# to improve performance, use only the first 8K to detect encoding
|
# to improve performance, use only the first 32K to detect encoding
|
||||||
if len(text) > 8192: guess = chardet.detect(text[:8192])
|
if len(text) > 32768: guess = chardet.detect(text[:32768])
|
||||||
else: guess = chardet.detect(text)
|
else: guess = chardet.detect(text)
|
||||||
if guess["confidence"] < 0.8:
|
if guess["confidence"] < 0.8:
|
||||||
raise UnicodeError
|
raise UnicodeError
|
||||||
|
|
Loading…
Reference in a new issue