diff lib/protocols.c @ 46:3da7765bc439

2002-10-31 Brian Masney <masneyb@gftp.org> * lib/protocols.c (gftp_get_next_file) - don't use g_filename_to_utf8. If g_locale_to_utf8 fails, print out a warning to the user on the console
author masneyb
date Fri, 01 Nov 2002 00:10:08 +0000
parents 311e29c40ed6
children e5f6054590b5
line wrap: on
line diff
--- a/lib/protocols.c	Thu Oct 31 23:55:17 2002 +0000
+++ b/lib/protocols.c	Fri Nov 01 00:10:08 2002 +0000
@@ -462,6 +462,7 @@
 #if GLIB_MAJOR_VERSION > 1
   gsize bread, bwrite;
   char *tempstr;
+  GError * error;
 #endif
 
   g_return_val_if_fail (request != NULL, -2);
@@ -483,19 +484,16 @@
 #if GLIB_MAJOR_VERSION > 1
       if (fle->file != NULL && !g_utf8_validate (fle->file, -1, NULL))
         {
+          error = NULL;
           if ((tempstr = g_locale_to_utf8 (fle->file, -1, &bread, 
-                                           &bwrite, NULL)) != NULL)
+                                           &bwrite, &error)) != 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;
-            }
-
+          else
+            g_warning ("Error when converting %s to UTF-8: %s\n", fle->file,
+                       error->message);
         }
 #endif