diff lib/protocols.c @ 916:936635b76f02

2007-4-26 Brian Masney <masneyb@gftp.org> * src/gtk/misc-gtk.c lib/gftp.h lib/protocols.c - added filename_utf8_encoded flag to the gftp_file structure. If this is false, then don't attempt to show the filename in the GTK port. The user can still select the blank filename though.
author masneyb
date Thu, 26 Apr 2007 23:47:34 +0000
parents f716c8dbeaff
children b099517df21a
line wrap: on
line diff
--- a/lib/protocols.c	Wed Apr 25 22:23:16 2007 +0000
+++ b/lib/protocols.c	Thu Apr 26 23:47:34 2007 +0000
@@ -703,12 +703,17 @@
 
       if (ret >= 0 && fle->file != NULL)
         {
-          utf8 = gftp_filename_to_utf8 (request, fle->file, &destlen);
-          if (utf8 != NULL)
+          if (g_utf8_validate (fle->file, -1, NULL))
+            fle->filename_utf8_encoded = 1;
+          else
             {
-              tmpfile = fle->file;
-              fle->file = utf8;
-              g_free (tmpfile);
+              utf8 = gftp_filename_to_utf8 (request, fle->file, &destlen);
+              if (utf8 != NULL)
+                {
+                  g_free (fle->file);
+                  fle->file = utf8;
+                  fle->filename_utf8_encoded = 1;
+                }
             }
         }