fix(plex): a sidecar subtitle in a legacy code page rendered its accents as U+FFFD
A Hungarian .srt beside the video (Windows-1250) was decoded as UTF-8 with errors=replace: one episode served 1391 U+FFFD and no accented letter. decode_subtitle now lets a BOM decide, keeps valid UTF-8, and otherwise reads the legacy code page of the stream's language (cp1250 for Central European, cp1251 for Cyrillic, else cp1252) — on the ffmpeg path too. The cache has no eviction, so its key is versioned (sub2_): a track cached broken is read again once instead of being served for good.
This commit is contained in:
@@ -311,8 +311,9 @@ def test_covered_ranges_coalesce_and_answer_membership():
|
||||
def test_a_cached_vtt_from_an_older_build_counts_as_complete(tmp_path):
|
||||
"""Before this change the cache only ever held whole tracks, and none of them has a sidecar.
|
||||
Reading one as "covers nothing" would re-extract every already-cached track after the upgrade."""
|
||||
(tmp_path / "sub_98614_0.vtt").write_text(_vtt(_cue("00:01.000", "00:02.000", "x")), "utf-8")
|
||||
assert subtitles.read_meta("sub_98614_0") == ([[0.0, 1_000_000_000.0]], True)
|
||||
key = subtitles.cache_key("98614", 0)
|
||||
(tmp_path / f"{key}.vtt").write_text(_vtt(_cue("00:01.000", "00:02.000", "x")), "utf-8")
|
||||
assert subtitles.read_meta(key) == ([[0.0, 1_000_000_000.0]], True)
|
||||
|
||||
|
||||
# --- the deep-review round: the seams between the window and the full pass ----------------------
|
||||
|
||||
Reference in New Issue
Block a user