Merge pull request #21525 from edx/BOM-367

BOM-367 Python 3 fixes
This commit is contained in:
Aarif
2019-09-25 16:07:44 +05:00
committed by GitHub

View File

@@ -654,7 +654,7 @@ class Transcript(object):
if input_format == 'srt':
if output_format == 'txt':
text = SubRipFile.from_string(content.decode('utf8')).text
text = SubRipFile.from_string(content.decode('utf-8')).text
return HTMLParser().unescape(text)
elif output_format == 'sjson':
@@ -663,7 +663,7 @@ class Transcript(object):
# the exception if something went wrong in parsing the transcript.
srt_subs = SubRipFile.from_string(
# Skip byte order mark(BOM) character
content.decode('utf-8-sig'),
content.decode('utf-8-sig') if six.PY2 else content.encode('utf-8').decode('utf-8-sig'),
error_handling=SubRipFile.ERROR_RAISE
)
except Error as ex: # Base exception from pysrt