Commit dd369f97 authored by Antoine Cellerier's avatar Antoine Cellerier

try fixing charset problems. I'll launch a win32 nightly, try it out and...

try fixing charset problems. I'll launch a win32 nightly, try it out and change it if it still doesn't work.
parent 892f3cf9
...@@ -185,7 +185,8 @@ static int Open( vlc_object_t *p_this ) ...@@ -185,7 +185,8 @@ static int Open( vlc_object_t *p_this )
p_sys->iconv_from_utf8 = p_sys->iconv_to_utf8 = (vlc_iconv_t)-1; p_sys->iconv_from_utf8 = p_sys->iconv_to_utf8 = (vlc_iconv_t)-1;
} }
free( psz_src ); p_sys->psz_charset = strdup( psz_src );
psz_src = NULL;
/* determine file handler associations */ /* determine file handler associations */
p_sys->i_handlers = 0; p_sys->i_handlers = 0;
...@@ -333,7 +334,7 @@ failed: ...@@ -333,7 +334,7 @@ failed:
} }
httpd_HostDelete( p_sys->p_httpd_host ); httpd_HostDelete( p_sys->p_httpd_host );
free( p_sys->psz_address ); free( p_sys->psz_address );
free( p_sys->psz_html_type ); free( p_sys->psz_html_type );
if( p_sys->iconv_from_utf8 != (vlc_iconv_t)-1 ) if( p_sys->iconv_from_utf8 != (vlc_iconv_t)-1 )
vlc_iconv_close( p_sys->iconv_from_utf8 ); vlc_iconv_close( p_sys->iconv_from_utf8 );
if( p_sys->iconv_to_utf8 != (vlc_iconv_t)-1 ) if( p_sys->iconv_to_utf8 != (vlc_iconv_t)-1 )
...@@ -542,6 +543,7 @@ static void ParseExecute( httpd_file_sys_t *p_args, char *p_buffer, ...@@ -542,6 +543,7 @@ static void ParseExecute( httpd_file_sys_t *p_args, char *p_buffer,
E_(mvar_AppendNewVar)( p_args->vars, "stream_length", length ); E_(mvar_AppendNewVar)( p_args->vars, "stream_length", length );
E_(mvar_AppendNewVar)( p_args->vars, "volume", volume ); E_(mvar_AppendNewVar)( p_args->vars, "volume", volume );
E_(mvar_AppendNewVar)( p_args->vars, "stream_state", state ); E_(mvar_AppendNewVar)( p_args->vars, "stream_state", state );
E_(mvar_AppendNewVar)( p_args->vars, "charset", ((intf_sys_t *)p_args->p_intf->p_sys)->psz_charset );
E_(SSInit)( &p_args->stack ); E_(SSInit)( &p_args->stack );
...@@ -569,7 +571,7 @@ int E_(HttpCallback)( httpd_file_sys_t *p_args, ...@@ -569,7 +571,7 @@ int E_(HttpCallback)( httpd_file_sys_t *p_args,
char **pp_data = (char **)_pp_data; char **pp_data = (char **)_pp_data;
FILE *f; FILE *f;
/* FIXME: do we need character encoding translation here ? */ /* FIXME: do we need character encoding translation here? */
if( ( f = fopen( p_args->file, "r" ) ) == NULL ) if( ( f = fopen( p_args->file, "r" ) ) == NULL )
{ {
Callback404( p_args, pp_data, pi_data ); Callback404( p_args, pp_data, pi_data );
......
...@@ -385,6 +385,7 @@ struct intf_sys_t ...@@ -385,6 +385,7 @@ struct intf_sys_t
input_thread_t *p_input; input_thread_t *p_input;
vlm_t *p_vlm; vlm_t *p_vlm;
char *psz_html_type; char *psz_html_type;
char *psz_charset;
vlc_iconv_t iconv_from_utf8, iconv_to_utf8; vlc_iconv_t iconv_from_utf8, iconv_to_utf8;
char *psz_address; char *psz_address;
......
...@@ -262,12 +262,25 @@ int E_(ParseDirectory)( intf_thread_t *p_intf, char *psz_root, ...@@ -262,12 +262,25 @@ int E_(ParseDirectory)( intf_thread_t *p_intf, char *psz_root,
if( !f->b_handler ) if( !f->b_handler )
{ {
char *psz_type = strdup( p_sys->psz_html_type );
if( strstr( &dir[strlen( psz_root )], ".xml" ) )
{
char *psz = strstr( psz_type, "html;" );
if( psz )
{
psz[0] = 'x';
psz[1] = 'm';
psz[2] = 'l';
psz[3] = ';';
psz[4] = ' ';
}
}
f->p_file = httpd_FileNew( p_sys->p_httpd_host, f->p_file = httpd_FileNew( p_sys->p_httpd_host,
f->name, f->name,
f->b_html ? ( strstr( &dir[strlen( psz_root )], ".xml" ) ? "text/xml; charset=UTF-8" : p_sys->psz_html_type ) : f->b_html ? psz_type : NULL,
NULL,
user, password, p_acl, user, password, p_acl,
E_(HttpCallback), f ); E_(HttpCallback), f );
free( psz_type );
if( f->p_file != NULL ) if( f->p_file != NULL )
{ {
TAB_APPEND( p_sys->i_files, p_sys->pp_files, f ); TAB_APPEND( p_sys->i_files, p_sys->pp_files, f );
......
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