]> git.sesse.net Git - vlc/commitdiff
try fixing charset problems. I'll launch a win32 nightly, try it out and change it...
authorAntoine Cellerier <dionoea@videolan.org>
Fri, 24 Mar 2006 14:16:12 +0000 (14:16 +0000)
committerAntoine Cellerier <dionoea@videolan.org>
Fri, 24 Mar 2006 14:16:12 +0000 (14:16 +0000)
modules/control/http/http.c
modules/control/http/http.h
modules/control/http/util.c

index 50c60675f4ccaf0f353db149bbea45338d05caba..d2a6276550a7976dadd0cd5364190e377b71ce73 100644 (file)
@@ -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;
     }
 
-    free( psz_src );
+    p_sys->psz_charset = strdup( psz_src );
+    psz_src = NULL;
 
     /* determine file handler associations */
     p_sys->i_handlers = 0;
@@ -333,7 +334,7 @@ failed:
     }
     httpd_HostDelete( p_sys->p_httpd_host );
     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 )
         vlc_iconv_close( p_sys->iconv_from_utf8 );
     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,
     E_(mvar_AppendNewVar)( p_args->vars, "stream_length", length );
     E_(mvar_AppendNewVar)( p_args->vars, "volume", volume );
     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 );
 
@@ -569,7 +571,7 @@ int  E_(HttpCallback)( httpd_file_sys_t *p_args,
     char **pp_data = (char **)_pp_data;
     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 )
     {
         Callback404( p_args, pp_data, pi_data );
index af24da4db9f23dbf085934bdbbde5307fbf15ee8..44b22ce14ea30f97cf0347a301e3833fc4ac56ca 100644 (file)
@@ -385,6 +385,7 @@ struct intf_sys_t
     input_thread_t      *p_input;
     vlm_t               *p_vlm;
     char                *psz_html_type;
+    char                *psz_charset;
     vlc_iconv_t         iconv_from_utf8, iconv_to_utf8;
 
     char                *psz_address;
index b12ccde8bdf9aabaa30fc85387dada09b8e8f676..15569ed4090c27f478635bfb1d91cb3908935f78 100644 (file)
@@ -262,12 +262,25 @@ int E_(ParseDirectory)( intf_thread_t *p_intf, char *psz_root,
 
             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->name,
-                                           f->b_html ? ( strstr( &dir[strlen( psz_root )], ".xml" ) ? "text/xml; charset=UTF-8" : p_sys->psz_html_type ) :
-                                            NULL,
+                                           f->b_html ? psz_type : NULL,
                                            user, password, p_acl,
                                            E_(HttpCallback), f );
+                free( psz_type );
                 if( f->p_file != NULL )
                 {
                     TAB_APPEND( p_sys->i_files, p_sys->pp_files, f );