summaryrefslogtreecommitdiffstats
path: root/subreader.c
diff options
context:
space:
mode:
authoreugeni <eugeni@b3059339-0415-0410-9bf9-f77b7e298cf2>2008-05-29 18:35:17 +0000
committereugeni <eugeni@b3059339-0415-0410-9bf9-f77b7e298cf2>2008-05-29 18:35:17 +0000
commitf5a8ce6408d5f33c387a93a0d4f7881edcdc2ce6 (patch)
tree0161bf53ee97f7f34e0db144861dbd73464a5618 /subreader.c
parent03a30e3a59b930cf623406c5e520fd903b564e62 (diff)
downloadmpv-f5a8ce6408d5f33c387a93a0d4f7881edcdc2ce6.tar.bz2
mpv-f5a8ce6408d5f33c387a93a0d4f7881edcdc2ce6.tar.xz
Clear iconv conversion state after each subtitle line.
This fixes a bug when the last character on a subtitle line is sometimes moved to the beginning of the next line. Patch by Guy Shapiro, bugs sguy org. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@26921 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'subreader.c')
-rw-r--r--subreader.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/subreader.c b/subreader.c
index dd9c7d2c31..5561639c6a 100644
--- a/subreader.c
+++ b/subreader.c
@@ -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;