diff -x CVS -x Root -x Repository -x Tag -x Entries -x Entries.Log -x .svn -x '*.rej' -x '*.orig' -x .cvsignore -N -r -u ./src/daemon/driver/driverCommands.ml ./src/daemon/driver/driverCommands.ml
--- ./src/daemon/driver/driverCommands.ml	2005-09-08 14:30:28.000000000 +0200
+++ ./src/daemon/driver/driverCommands.ml	2005-09-08 15:29:56.000000000 +0200
@@ -1877,7 +1877,7 @@
                    var getdir = prompt('Input: <priority#> <directory> (surround dir with quotes if necessary)','0 /home/mldonkey/share')
                    var reg = new RegExp (' ', 'gi') ;
                    var outstr = getdir.replace(reg, '+');
-                   parent.fstatus.location.href='submit?q=share+' + outstr;
+                   parent.fstatus.location.href='submit?q=share+' + encodeURI(outstr);
                    setTimeout('window.location.reload()',1000);
                     }\\\"\\>Add Share\\</a\\>
 \\</td\\>
@@ -1921,7 +1921,7 @@
         \\<td class=\\\"sr ar\\\"\\>%s\\</td\\>
         \\<td class=\\\"sr\\\"\\>%s\\</td\\>\\</tr\\>"
 		(if !counter mod 2 == 0 then "dl-1" else "dl-2")
-		dir
+		(Url.encode dir)
 		shared_dir.shdir_priority
 		dir
 		shared_dir.shdir_strategy
@@ -2100,7 +2100,7 @@
                 incr counter;
 
                 let ed2k = Printf.sprintf "ed2k://|file|%s|%s|%s|/"
-                    (Filename.basename impl.impl_shared_codedname)
+                    (Url.encode (Filename.basename impl.impl_shared_codedname))
                   (Int64.to_string impl.impl_shared_size)
                   (Md4.to_string impl.impl_shared_id) in
 
@@ -2157,7 +2157,7 @@
         List.iter (fun impl ->
           if (impl.impl_shared_id <> Md4.null) then
            Printf.bprintf buf "ed2k://|file|%s|%s|%s|/\n"
-              (Filename.basename impl.impl_shared_codedname)
+              (Url.encode (Filename.basename impl.impl_shared_codedname))
               (Int64.to_string impl.impl_shared_size)
               (Md4.to_string impl.impl_shared_id);
         ) list;
diff -x CVS -x Root -x Repository -x Tag -x Entries -x Entries.Log -x .svn -x '*.rej' -x '*.orig' -x .cvsignore -N -r -u ./src/daemon/driver/driverControlers.ml ./src/daemon/driver/driverControlers.ml
--- ./src/daemon/driver/driverControlers.ml	2005-09-06 13:24:59.000000000 +0200
+++ ./src/daemon/driver/driverControlers.ml	2005-09-08 15:29:56.000000000 +0200
@@ -93,6 +93,7 @@
 
 let eval auth cmd o =
   let buf = o.conn_buf in
+  let cmd = Url.decode cmd in
   let cmd =
     if String2.check_prefix cmd "ed2k://" then "dllink " ^ cmd
     else if String2.check_prefix cmd "fha://" then "ovlink " ^ cmd
diff -x CVS -x Root -x Repository -x Tag -x Entries -x Entries.Log -x .svn -x '*.rej' -x '*.orig' -x .cvsignore -N -r -u ./src/gtk/gui/gui_uploads.ml ./src/gtk/gui/gui_uploads.ml
--- ./src/gtk/gui/gui_uploads.ml	2005-04-04 22:25:55.000000000 +0200
+++ ./src/gtk/gui/gui_uploads.ml	2005-09-08 15:29:56.000000000 +0200
@@ -140,7 +140,7 @@
               Ed2k md4 ->
                 begin
                   let link = Printf.sprintf "ed2k://|file|%s|%Ld|%s|"
-                             (Filename.basename s.shared_filename)
+                             (Url.encode (Filename.basename s.shared_filename))
                              s.shared_size
                              (Md4.to_string md4)
                   in
diff -x CVS -x Root -x Repository -x Tag -x Entries -x Entries.Log -x .svn -x '*.rej' -x '*.orig' -x .cvsignore -N -r -u ./src/gtk/newgui/gui_uploads.ml ./src/gtk/newgui/gui_uploads.ml
--- ./src/gtk/newgui/gui_uploads.ml	2005-04-04 22:25:55.000000000 +0200
+++ ./src/gtk/newgui/gui_uploads.ml	2005-09-08 15:29:56.000000000 +0200
@@ -150,7 +150,7 @@
               Ed2k md4 ->
                 begin
                   let link = Printf.sprintf "ed2k://|file|%s|%Ld|%s|"
-                             (Filename.basename s.shared_filename)
+                             (Url.encode (Filename.basename s.shared_filename))
                              s.shared_size
                              (Md4.to_string md4)
                   in
diff -x CVS -x Root -x Repository -x Tag -x Entries -x Entries.Log -x .svn -x '*.rej' -x '*.orig' -x .cvsignore -N -r -u ./src/gtk2/gui/guiUploads.ml ./src/gtk2/gui/guiUploads.ml
--- ./src/gtk2/gui/guiUploads.ml	2005-04-04 21:36:46.000000000 +0200
+++ ./src/gtk2/gui/guiUploads.ml	2005-09-08 15:29:56.000000000 +0200
@@ -607,7 +607,7 @@
               Ed2k md4 ->
                 begin
                   let link = Printf.sprintf "ed2k://|file|%s|%Ld|%s|" 
-                             (Filename.basename s.shared_filename)
+                             (Url.encode (Filename.basename s.shared_filename))
                              s.shared_size
                              (Md4.to_string md4)
                   in
diff -x CVS -x Root -x Repository -x Tag -x Entries -x Entries.Log -x .svn -x '*.rej' -x '*.orig' -x .cvsignore -N -r -u ./src/networks/donkey/donkeyInteractive.ml ./src/networks/donkey/donkeyInteractive.ml
--- ./src/networks/donkey/donkeyInteractive.ml	2005-09-01 02:04:12.000000000 +0200
+++ ./src/networks/donkey/donkeyInteractive.ml	2005-09-08 15:29:56.000000000 +0200
@@ -511,7 +511,7 @@
 
 
 let parse_donkey_url url =
-  match String2.split (String.escaped url) '|' with
+  match String2.split ((*String.escaped*) url) '|' with
 (* TODO RESULT *)
   | "ed2k://" :: "file" :: name :: size :: md4 :: _
   | "file" :: name :: size :: md4 :: _ ->
@@ -1211,7 +1211,7 @@
       html_mods_td buf [
         ("ed2k link", "sr br", "ed2k link");
         ("", "sr", Printf.sprintf "\\<a href=\\\"ed2k://|file|%s|%s|%s|/\\\"\\>ed2k://|file|%s|%s|%s|/\\</A\\>"
-            (file_best_name file)
+            (Url.encode (file_best_name file))
           (Int64.to_string (file_size file))
           (Md4.to_string file.file_md4)
           (file_best_name file)
@@ -1399,7 +1399,7 @@
   );
   file_ops.op_file_comment <- (fun file ->
       Printf.sprintf "ed2k://|file|%s|%Ld|%s|"
-        (file_best_name file)
+        (Url.encode (file_best_name file))
       (file_size file)
       (Md4.to_string file.file_md4)
   );
diff -x CVS -x Root -x Repository -x Tag -x Entries -x Entries.Log -x .svn -x '*.rej' -x '*.orig' -x .cvsignore -N -r -u ./src/utils/lib/stubs_c.c ./src/utils/lib/stubs_c.c
--- ./src/utils/lib/stubs_c.c	2005-09-08 14:44:53.000000000 +0200
+++ ./src/utils/lib/stubs_c.c	2005-09-08 15:29:56.000000000 +0200
@@ -921,7 +921,7 @@
 #if defined(__MINGW32__)
 /* taken from www.greatchief.plus.com/gpc/os-hacks.h */
 #define _fullpath(res,path,size) \
-  (GetFullPathName ((path), (size), (res), NULL) ? (res) : NULL)
+  (GetFullPathNameW ((path), (size), (res), NULL) ? (res) : NULL)
 
 #define realpath(path,resolved_path) _fullpath(resolved_path, path, MAX_PATH)
 
@@ -944,13 +944,15 @@
    long    f_spare[6]; /* spare for later */
 };
 
-static int statfs (const char *path, struct statfs *buf)
+static int statfs (const unsigned char *path, struct statfs *buf)
   {
     HINSTANCE h;
     FARPROC f;
     int retval = 0;
-    char tmp [MAX_PATH], resolved_path [MAX_PATH];
-    realpath(path, resolved_path);
+    WCHAR tmp [MAX_PATH], resolved_path [MAX_PATH];
+    WCHAR * wpath=utf8_to_utf16(path);
+    realpath(wpath, resolved_path);
+    free(wpath);
     if (!resolved_path)
       retval = - 1;
     else
@@ -958,7 +960,7 @@
         /* check whether GetDiskFreeSpaceExA is supported */
         h = LoadLibraryA ("kernel32.dll");
         if (h)
-          f = GetProcAddress (h, "GetDiskFreeSpaceExA");
+          f = GetProcAddress (h, "GetDiskFreeSpaceExW");
         else
           f = NULL;
         if (f)
@@ -981,7 +983,7 @@
           {
             DWORD sectors_per_cluster, bytes_per_sector;
             if (h) FreeLibrary (h);
-            if (!GetDiskFreeSpaceA (resolved_path, &sectors_per_cluster,
+            if (!GetDiskFreeSpaceW (resolved_path, &sectors_per_cluster,
                    &bytes_per_sector, &buf -> f_bavail, &buf -> f_blocks))
               {
                 errno = ENOENT;
@@ -999,11 +1001,11 @@
       }
 
     /* get the FS volume information */
-    if (strspn (":", resolved_path) > 0) resolved_path [3] = '\0'; /* we want only the root */    
-    if (GetVolumeInformation (resolved_path, NULL, 0, &buf -> f_fsid, &buf -> f_namelen, NULL, tmp, MAX_PATH))
+    if (wcsspn (L":", resolved_path) > 0) resolved_path [3] = '\0'; /* we want only the root */    
+    if (GetVolumeInformationW (resolved_path, NULL, 0, &buf -> f_fsid, &buf -> f_namelen, NULL, tmp, MAX_PATH))
     /* http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/fs/getvolumeinformation.asp */
      {
-     	if (strcasecmp ("NTFS", tmp) == 0)
+     	if (_wcsicmp (L"NTFS", tmp) == 0)
      	 {
      	   buf -> f_type = NTFS_SUPER_MAGIC;
      	 }
@@ -1044,7 +1046,7 @@
 {
   CAMLparam1 (pathv);
   CAMLlocal1 (bufv);
-  const char *path = String_val (pathv);
+  const unsigned char *path = String_val (pathv);
   struct statfs buf;
   if (statfs (path, &buf) == -1)
     raise_constant(*(value *)caml_named_value("error"));
diff -x CVS -x Root -x Repository -x Tag -x Entries -x Entries.Log -x .svn -x '*.rej' -x '*.orig' -x .cvsignore -N -r -u ./tools/mld_hash.ml ./tools/mld_hash.ml
--- ./tools/mld_hash.ml	2005-08-26 23:03:50.000000000 +0200
+++ ./tools/mld_hash.ml	2005-09-08 15:29:56.000000000 +0200
@@ -183,7 +183,7 @@
   let file_size = Unix32.getsize64 fd false in
   let md4 = ed2k_hash_file fd file_size partial in
   lprintf "ed2k://|file|%s|%Ld|%s|/\n" 
-    (Filename.basename filename)
+    (Url.encode (Filename.basename filename))
     file_size
     (Md4.to_string md4)
 
@@ -317,7 +317,7 @@
         lprintf "Computing ed2k hash\n";
         let md4 = ed2k_hash_file file file_size partial in
         lprintf "ed2k://|file|%s|%Ld|%s|\n" 
-          filename
+          (Url.encode filename)
           file_size
           (Md4.to_string md4);
         
