• wm4's avatar
    movtextdec: fix handling of UTF-8 subtitles · b0644c3e
    wm4 authored
    Subtitles which contained styled UTF-8 subtitles (i.e. not just 7 bit
    ASCII characters) were not handled correctly. The spec mandates that
    styling start/end ranges are in "characters". It's not quite clear what
    a "character" is supposed to be, but maybe they mean unicode codepoints.
    
    FFmpeg's decoder treated the style ranges as byte idexes, which could
    lead to UTF-8 sequences being broken, and the common code dropping the
    whole subtitle line.
    
    Change this and count the codepoint instead. This also means that even
    if this is somehow wrong, the decoder won't break UTF-8 sequences
    anymore. The sample which led me to investigate this now appears to work
    correctly.
    b0644c3e
movtextdec.c 16.5 KB