[MPlayer-cvslog] r34443 - trunk/sub/subreader.c

iive subversion at mplayerhq.hu
Wed Dec 14 01:17:50 CET 2011


Author: iive
Date: Wed Dec 14 01:17:49 2011
New Revision: 34443

Log:
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.

Modified:
   trunk/sub/subreader.c

Modified: trunk/sub/subreader.c
==============================================================================
--- trunk/sub/subreader.c	Tue Dec 13 14:23:06 2011	(r34442)
+++ trunk/sub/subreader.c	Wed Dec 14 01:17:49 2011	(r34443)
@@ -1514,7 +1514,7 @@ sub_data* sub_read_file (const char *fil
         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);


More information about the MPlayer-cvslog mailing list