Commit 73a9dbad authored by Derk-Jan Hartman's avatar Derk-Jan Hartman

* Revert the Default charset encoding back to ISO-8859-1

  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.
parent 60c51db9
......@@ -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 )
{
......
......@@ -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 );
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment