[vlc-devel] commit: decode_URI: do not call EnsureUTF8 ( Rémi Denis-Courmont )

git version control git at videolan.org
Sat Feb 20 20:11:37 CET 2010


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Feb 20 21:10:58 2010 +0200| [2acf64c7bfceffd8f5f288b97f54d4a0ef348dec] | committer: Rémi Denis-Courmont 

decode_URI: do not call EnsureUTF8

This fixes opening files with non-UTF8 sequences in their path (as long
as the file:// URI is %-encoded correctly).

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=2acf64c7bfceffd8f5f288b97f54d4a0ef348dec
---

 modules/access/ftp.c |    3 +++
 src/input/item.c     |    4 ++++
 src/test/url.c       |    5 ++---
 src/text/strings.c   |    1 -
 4 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/modules/access/ftp.c b/modules/access/ftp.c
index c5ffb2f..6a1a74e 100644
--- a/modules/access/ftp.c
+++ b/modules/access/ftp.c
@@ -41,6 +41,7 @@
 #include <vlc_network.h>
 #include <vlc_url.h>
 #include <vlc_sout.h>
+#include <vlc_charset.h>
 
 #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 );
+    /* FIXME: check for UTF-8 support, otherwise only ASCII is allowed */
+    EnsureUTF8( url->psz_path );
     return VLC_SUCCESS;
 }
 
diff --git a/src/input/item.c b/src/input/item.c
index cdc60ed..9872e99 100644
--- a/src/input/item.c
+++ b/src/input/item.c
@@ -30,6 +30,7 @@
 #include <vlc_url.h>
 #include "vlc_playlist.h"
 #include "vlc_interface.h"
+#include <vlc_charset.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 )
+        {
             decode_URI( p_i->psz_name );
+            EnsureUTF8( p_i->psz_name );
+        }
     }
     else
     {   /* Strip login and password from title */
diff --git a/src/test/url.c b/src/test/url.c
index f5df985..80f564f 100644
--- a/src/test/url.c
+++ b/src/test/url.c
@@ -103,10 +103,9 @@ int main (void)
     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%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 ("", "");
diff --git a/src/text/strings.c b/src/text/strings.c
index eb0350a..657641a 100644
--- a/src/text/strings.c
+++ b/src/text/strings.c
@@ -109,7 +109,6 @@ char *decode_URI( char *psz )
         }
     }
     *out = '\0';
-    EnsureUTF8( psz );
     return psz;
 }
 




More information about the vlc-devel mailing list