]> git.sesse.net Git - vlc/commitdiff
decode_URI: do not call EnsureUTF8
authorRémi Denis-Courmont <remi@remlab.net>
Sat, 20 Feb 2010 19:10:58 +0000 (21:10 +0200)
committerRémi Denis-Courmont <remi@remlab.net>
Sat, 20 Feb 2010 19:10:58 +0000 (21:10 +0200)
This fixes opening files with non-UTF8 sequences in their path (as long
as the file:// URI is %-encoded correctly).

modules/access/ftp.c
src/input/item.c
src/test/url.c
src/text/strings.c

index c5ffb2f2c44d9694edf1682ba9d482b13ceac010..6a1a74e3ebb138b3b8369e2f886ec1a9ada00357 100644 (file)
@@ -41,6 +41,7 @@
 #include <vlc_network.h>
 #include <vlc_url.h>
 #include <vlc_sout.h>
 #include <vlc_network.h>
 #include <vlc_url.h>
 #include <vlc_sout.h>
+#include <vlc_charset.h>
 
 #ifndef IPPORT_FTP
 # define IPPORT_FTP 21u
 
 #ifndef IPPORT_FTP
 # define IPPORT_FTP 21u
@@ -316,6 +317,8 @@ static int parseURL( vlc_url_t *url, const char *path )
             return VLC_EGENERIC; /* ASCII and directory not supported */
     }
     decode_URI( url->psz_path );
             return VLC_EGENERIC; /* ASCII and directory not supported */
     }
     decode_URI( url->psz_path );
+    /* FIXME: check for UTF-8 support, otherwise only ASCII is allowed */
+    EnsureUTF8( url->psz_path );
     return VLC_SUCCESS;
 }
 
     return VLC_SUCCESS;
 }
 
index cdc60edef1710ff6e4142fca86322031339a3120..9872e99ba6afe96d48794764aa1edb172706664b 100644 (file)
@@ -30,6 +30,7 @@
 #include <vlc_url.h>
 #include "vlc_playlist.h"
 #include "vlc_interface.h"
 #include <vlc_url.h>
 #include "vlc_playlist.h"
 #include "vlc_interface.h"
+#include <vlc_charset.h>
 
 #include "item.h"
 #include "info.h"
 
 #include "item.h"
 #include "info.h"
@@ -388,7 +389,10 @@ void input_item_SetURI( input_item_t *p_i, const char *psz_uri )
 
         /* Make the name more readable */
         if( p_i->psz_name )
 
         /* Make the name more readable */
         if( p_i->psz_name )
+        {
             decode_URI( p_i->psz_name );
             decode_URI( p_i->psz_name );
+            EnsureUTF8( p_i->psz_name );
+        }
     }
     else
     {   /* Strip login and password from title */
     }
     else
     {   /* Strip login and password from title */
index f5df985fab8603d1771cfb5c7989f41edcbf9c7f..80f564fb453f72f32fee329384e99ba37045f4d1 100644 (file)
@@ -103,10 +103,9 @@ int main (void)
     test_decode ("%2", "%2");
     test_decode ("%0000", "");
 
     test_decode ("%2", "%2");
     test_decode ("%0000", "");
 
-    /* UTF-8 tests */
+    /* Non-ASCII tests */
     test_decode ("T%C3%a9l%c3%A9vision+%e2%82%Ac", "Télévision €");
     test_decode ("T%C3%a9l%c3%A9vision+%e2%82%Ac", "Télévision €");
-    test_decode ("T%E9l%E9vision", "T?l?vision");
-    test_decode ("%C1%94%C3%a9l%c3%A9vision", "??élévision"); /* overlong */
+    test_decode ("T%E9l%E9vision", "T\xe9l\xe9vision");
 
     /* Base 64 tests */
     test_b64 ("", "");
 
     /* Base 64 tests */
     test_b64 ("", "");
index eb0350aa651f22a1473b6013ab4f9922c2b99e0f..657641a5849d9ef2f9ffd4dcb219e9ff7e589921 100644 (file)
@@ -109,7 +109,6 @@ char *decode_URI( char *psz )
         }
     }
     *out = '\0';
         }
     }
     *out = '\0';
-    EnsureUTF8( psz );
     return psz;
 }
 
     return psz;
 }