+ /* Now we are sure that we have a complete valid unescaped URI beginning
+ with the protocol. We want to escape it. However, gnomevfs's escaping
+ function are broken and will try to escape characters un the username/
+ password field. So parse the URI with vlc_UrlParse ans only escape the
+ path */
+
+ vlc_url_t url;
+ char *psz_escaped_path;
+ char *psz_path_begin;
+
+ vlc_UrlParse( &url, psz_unescaped, 0 );
+ psz_escaped_path = gnome_vfs_escape_path_string( url.psz_path );
+
+ if( psz_escaped_path )
+ {
+ /* Now let's reconstruct a valid URI from all that stuff */
+ psz_path_begin = psz_unescaped + strlen( psz_unescaped )
+ - strlen( url.psz_path );
+ *psz_path_begin = '\0';
+ psz_uri = malloc( strlen( psz_unescaped ) +
+ strlen( psz_escaped_path ) + 1 );
+ sprintf( psz_uri, "%s%s",psz_unescaped, psz_escaped_path );
+
+ g_free( psz_escaped_path );
+ g_free( psz_unescaped );
+ }
+ else
+ {
+ psz_uri = psz_unescaped;
+ }
+ }
+ else
+ {
+ psz_uri = psz_unescaped;