# HG changeset patch # User iive # Date 1323821869 0 # Node ID 316f6edb49de50c0b4a7b56abdc55f7a0151ff95 # Parent 60ac9c33695b830a5785b569c6fa0616a8672c1c Avoid double conversion from utf16/ucs2 to utf8 for text subtitles. There is code that auto-detects utf16 encoding of the subtitle stream and forces the reading functions to convert it to native utf8. The bug happens when using enca to (correctly) guess that the input file has ucs2 encoding and tries to convert the input stream to utf8, again. In my case iconv did not accept the input and discarded the subtitles completely. diff -r 60ac9c33695b -r 316f6edb49de sub/subreader.c --- a/sub/subreader.c Tue Dec 13 13:23:06 2011 +0000 +++ b/sub/subreader.c Wed Dec 14 00:17:49 2011 +0000 @@ -1514,7 +1514,7 @@ sub=srp->read(fd,sub,utf16); if(!sub) break; // EOF #ifdef CONFIG_ICONV - if ((sub!=ERR) && sub_utf8 == 2) sub=subcp_recode(sub); + if ((sub!=ERR) && sub_utf8 == 2 && utf16 == 0) sub=subcp_recode(sub); #endif #ifdef CONFIG_FRIBIDI if (sub!=ERR) sub=sub_fribidi(sub,sub_utf8,0);