diff lib/protocols.c @ 45:311e29c40ed6

2002-10-31 Brian Masney <masneyb@gftp.org> * src/gtk/*.[ch] - don't check for gtk+ version based on the minor version. May cause problems later on. * lib/protocols.c src/gtk/bookmarks.c src/gtk/misc-gtk.c - use UTF8 functions for user data when using glib 2.0
author masneyb
date Thu, 31 Oct 2002 23:55:17 +0000
parents 4bcfaf6307b5
children 3da7765bc439
line wrap: on
line diff
--- a/lib/protocols.c	Wed Oct 30 22:56:30 2002 +0000
+++ b/lib/protocols.c	Thu Oct 31 23:55:17 2002 +0000
@@ -459,6 +459,10 @@
 {
   FILE * fd;
   int ret;
+#if GLIB_MAJOR_VERSION > 1
+  gsize bread, bwrite;
+  char *tempstr;
+#endif
 
   g_return_val_if_fail (request != NULL, -2);
 
@@ -476,6 +480,25 @@
       gftp_file_destroy (fle);
       ret = request->get_next_file (request, fle, fd);
 
+#if GLIB_MAJOR_VERSION > 1
+      if (fle->file != NULL && !g_utf8_validate (fle->file, -1, NULL))
+        {
+          if ((tempstr = g_locale_to_utf8 (fle->file, -1, &bread, 
+                                           &bwrite, NULL)) != NULL)
+            {
+              g_free (fle->file);
+              fle->file = tempstr;
+            }
+          else if ((tempstr = g_filename_to_utf8 (fle->file, -1, &bread, 
+                                                  &bwrite, NULL)) != NULL)
+            {
+              g_free (fle->file);
+              fle->file = tempstr;
+            }
+
+        }
+#endif
+
       if (ret >= 0 && !request->cached && request->cachefd != NULL && 
           request->last_dir_entry != NULL)
         {