]> git.sesse.net Git - vlc/commitdiff
* Revert the Default charset encoding back to ISO-8859-1
authorDerk-Jan Hartman <hartman@videolan.org>
Sat, 14 Jan 2006 00:03:13 +0000 (00:03 +0000)
committerDerk-Jan Hartman <hartman@videolan.org>
Sat, 14 Jan 2006 00:03:13 +0000 (00:03 +0000)
  No longer use the charset of the OS. OS X is UTF-8 for instance, but most subs are simply in Latin-1.
* In case we did BOM detection with stream_ReadLine, set subsdec-encoding to UTF-8 automatically.

modules/codec/subsdec.c
src/input/stream.c

index 26d1dda002901caf6b3e53a43c6b853af5a9e1a8..256646d4ab7d4f45f20d9007873fddc95446c084 100644 (file)
@@ -53,7 +53,7 @@ static subpicture_t *DecodeBlock   ( decoder_t *, block_t ** );
 static subpicture_t *ParseText     ( decoder_t *, block_t * );
 static void         StripTags      ( char * );
 
-#define DEFAULT_NAME "System Default"
+#define DEFAULT_NAME "Default"
 
 /*****************************************************************************
  * Module descriptor.
@@ -150,11 +150,8 @@ static int OpenDecoder( vlc_object_t *p_this )
         var_Get( p_dec, "subsdec-encoding", &val );
         if( !strcmp( val.psz_string, DEFAULT_NAME ) )
         {
-            char *psz_charset =(char*)malloc( 100 );
-            vlc_current_charset( &psz_charset );
-            p_sys->iconv_handle = vlc_iconv_open( "UTF-8", psz_charset );
-            msg_Dbg( p_dec, "using character encoding: %s", psz_charset );
-            free( psz_charset );
+            p_sys->iconv_handle = vlc_iconv_open( "UTF-8", "ISO-8859-1" );
+            msg_Dbg( p_dec, "using default character encoding: %s", "ISO-8859-1" );
         }
         else if( val.psz_string )
         {
index f7baea1bf93e199bc0000766cf6f3876febec9b9..8044c5758475b164132c76bc32f474fba5518c96 100644 (file)
@@ -1465,6 +1465,7 @@ char * stream_ReadLine( stream_t *s )
             /* Open the converter if we need it */
             if( psz_encoding != NULL )
             {
+                input_thread_t *p_input;
                 msg_Dbg( s, "%s BOM detected", psz_encoding );
                 if( s->i_char_width > 1 )
                 {
@@ -1473,6 +1474,15 @@ char * stream_ReadLine( stream_t *s )
                     {
                         msg_Err( s, "iconv_open failed" );
                     }
+                    var_Create( s->p_parent->p_parent, "subsdec-encoding", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
+                    var_SetString( s->p_parent->p_parent, "subsdec-encoding", "UTF-8" );
+                }
+                p_input = (input_thread_t *)vlc_object_find( s, VLC_OBJECT_INPUT, FIND_PARENT );
+                if( p_input != NULL)
+                {
+                    var_Create( p_input, "subsdec-encoding", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
+                    var_SetString( p_input, "subsdec-encoding", "UTF-8" );
+                    vlc_object_release( p_input );
                 }
                 if( psz_encoding ) free( psz_encoding );
             }