--- /home/john/gnulib/lib/rename.c	2011-02-17 18:39:33.000000000 +0100
+++ rename.c	2011-05-28 18:18:35.000000000 +0200
@@ -39,6 +39,33 @@
 
 # include "dirname.h"
 
+#include <iconv.h>
+
+iconv_t cv_posix_to_w32 ;
+
+void
+xx_setup(void)
+{
+  cv_posix_to_w32 = iconv_open ("UTF-16LE", "UTF-8");
+}
+
+#define OUTSIZE 4096
+
+char *
+posix_to_w32 (const char *in)
+{
+  int i;
+  size_t insize = strlen (in);
+  size_t outsize = OUTSIZE;
+  char *out = malloc (OUTSIZE);
+
+  memset (out, 0, OUTSIZE);
+  char *s = out;
+  int xx = iconv (cv_posix_to_w32, &in, &insize, &s, &outsize);
+  return out;
+}
+
+
 /* Rename the file SRC to DST.  This replacement is necessary on
    Windows, on which the system rename function will not replace
    an existing DST.  */
@@ -171,11 +198,12 @@
       free (dst_temp);
     }
 
+  xx_setup ();
   /* MoveFileEx works if SRC is a directory without any flags, but
      fails with MOVEFILE_REPLACE_EXISTING, so try without flags first.
      Thankfully, MoveFileEx handles hard links correctly, even though
      rename() does not.  */
-  if (MoveFileEx (src, dst, 0))
+  if (MoveFileExW (posix_to_w32(src), posix_to_w32(dst), 0))
     return 0;
 
   /* Retry with MOVEFILE_REPLACE_EXISTING if the move failed
