]> git.sesse.net Git - vlc/commitdiff
* don't convert UTF-8 -> UTF-8 because we found a BOM.
authorDerk-Jan Hartman <hartman@videolan.org>
Sat, 10 Dec 2005 23:59:43 +0000 (23:59 +0000)
committerDerk-Jan Hartman <hartman@videolan.org>
Sat, 10 Dec 2005 23:59:43 +0000 (23:59 +0000)
src/input/stream.c

index d8aefaf8048275cadca43b8916a1f178259e89e2..28830e50ce8b05ba0f843d74be67634d9cdf4797 100644 (file)
@@ -1428,19 +1428,26 @@ char * stream_ReadLine( stream_t *s )
                 s->i_char_width = 2;
                 i_bom_size = 2;
             }
-            /* Seek past the offset */
-            stream_Seek( s, i_bom_size );
-            p_data += i_bom_size;
-            i_data -= i_bom_size;
+
+            /* Seek past the BOM */
+            if( i_bom_size )
+            {
+                stream_Seek( s, i_bom_size );
+                p_data += i_bom_size;
+                i_data -= i_bom_size;
+            }
 
             /* Open the converter if we need it */
             if( psz_encoding != NULL )
             {
                 msg_Dbg( s, "%s BOM detected", psz_encoding );
-                s->conv = vlc_iconv_open( "UTF-8", psz_encoding );
-                if( s->conv == (vlc_iconv_t)-1 )
+                if( s->i_char_width > 1 )
                 {
-                    msg_Err( s, "iconv_open failed" );
+                    s->conv = vlc_iconv_open( "UTF-8", psz_encoding );
+                    if( s->conv == (vlc_iconv_t)-1 )
+                    {
+                        msg_Err( s, "iconv_open failed" );
+                    }
                 }
                 if( psz_encoding ) free( psz_encoding );
             }