From f321791819e6ef83734e46c82d30a47d4043eedd Mon Sep 17 00:00:00 2001 From: Puyodead1 Date: Thu, 2 Feb 2023 17:54:46 -0500 Subject: [PATCH] Attempt to fix encoding problems with caption conversion (#92, #98, #97) --- vtt_to_srt.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vtt_to_srt.py b/vtt_to_srt.py index d262b70..42c7c4c 100644 --- a/vtt_to_srt.py +++ b/vtt_to_srt.py @@ -9,7 +9,7 @@ def convert(directory, filename): index = 0 vtt_filepath = os.path.join(directory, filename + ".vtt") srt_filepath = os.path.join(directory, filename + ".srt") - srt = open(srt_filepath, mode="w", errors="ignore") + srt = open(srt_filepath, mode='w', encoding='utf8', errors='ignore') for caption in WebVTT().read(vtt_filepath): index += 1 @@ -17,4 +17,4 @@ def convert(directory, filename): end = SubRipTime(0, 0, caption.end_in_seconds) srt.write( SubRipItem(index, start, end, html.unescape( - caption.text)).__str__() + "\n") + caption.text)).__str__() + "\n") \ No newline at end of file