diff options
Diffstat (limited to 'subreader.c')
-rw-r--r-- | subreader.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/subreader.c b/subreader.c index 63b0ed3efa..5561639c6a 100644 --- a/subreader.c +++ b/subreader.c @@ -68,7 +68,7 @@ unsigned long previous_sub_end; #endif static int eol(char p) { - return (p=='\r' || p=='\n' || p=='\0'); + return p=='\r' || p=='\n' || p=='\0'; } /* Remove leading and trailing space */ @@ -1133,6 +1133,11 @@ subtitle* subcp_recode (subtitle *sub) free(ot); continue; } + // In some stateful encodings, we must clear the state to handle the last character + if (iconv(icdsc, NULL, NULL, + &op, &oleft) == (size_t)(-1)) { + mp_msg(MSGT_SUBREADER,MSGL_WARN,"SUB: error recoding line, can't clear encoding state.\n"); + } *op='\0' ; free (sub->text[l]); sub->text[l] = ot; |