0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-20 12:02:23 +02:00

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
This commit is contained in:
eugeni 2008-05-29 18:35:17 +00:00
parent 03a30e3a59
commit f5a8ce6408

View File

@ -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;