changeset 579:5dc685bf403e

2004-10-3 Brian Masney <masneyb@gftp.org> * lib/protocols.c (gftp_string_to_utf8) - if the current string is already in UTF-8, always return NULL, even if the iconv module is initialized for this session. If there is an error converting the non-UTF8 string to the current locale, then display a message to the user
author masneyb
date Mon, 04 Oct 2004 02:07:33 +0000
parents 6451504bed0b
children 87c22f8b1d60
files ChangeLog lib/protocols.c
diffstat 2 files changed, 19 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sat Oct 02 12:59:49 2004 +0000
+++ b/ChangeLog	Mon Oct 04 02:07:33 2004 +0000
@@ -1,3 +1,10 @@
+2004-10-3 Brian Masney <masneyb@gftp.org>
+	* lib/protocols.c (gftp_string_to_utf8) - if the current string is
+	already in UTF-8, always return NULL, even if the iconv module is
+	initialized for this session. If there is an error converting the
+	non-UTF8 string to the current locale, then display a message to the
+	user
+
 2004-10-2 Brian Masney <masneyb@gftp.org>
 	* lib/protocols.c (gftp_parse_bookmark) - convert the local and remote
 	directories from UTF8 to the current locale specified in the
@@ -2916,7 +2923,7 @@
 
 	* cvsclean - added this script
 
-	* *.[ch] - added $Id: ChangeLog,v 1.339 2004/10/02 12:59:49 masneyb Exp $ tags
+	* *.[ch] - added $Id: ChangeLog,v 1.340 2004/10/04 02:07:33 masneyb Exp $ tags
 
 	* debian/* - updated files from Debian maintainer
 
--- a/lib/protocols.c	Sat Oct 02 12:59:49 2004 +0000
+++ b/lib/protocols.c	Mon Oct 04 02:07:33 2004 +0000
@@ -448,11 +448,11 @@
   if (request == NULL)
     return (NULL);
 
-  if (request->iconv_initialized)
+  if (g_utf8_validate (str, -1, NULL))
+    return (NULL);
+  else if (request->iconv_initialized)
     return (g_convert_with_iconv (str, -1, request->iconv, &bread, &bwrite, 
                                   &error));
-  else if (g_utf8_validate (str, -1, NULL))
-    return (NULL);
 
   gftp_lookup_request_option (request, "remote_charsets", &tempstr);
   if (*tempstr == '\0')
@@ -461,6 +461,10 @@
       if ((ret = g_locale_to_utf8 (str, -1, &bread, &bwrite, &error)) != NULL)
         return (ret);
 
+      /* Don't use request->logging_function since the strings must be in UTF-8
+         for the GTK+ 2.x port */
+      printf (_("Error converting string '%s' to UTF-8 from current locale: %s\n"),
+              str, error->message);
       return (NULL);
     }
 
@@ -514,6 +518,10 @@
       if ((ret = g_locale_from_utf8 (str, -1, &bread, &bwrite, &error)) != NULL)
         return (ret);
 
+      /* Don't use request->logging_function since the strings must be in UTF-8
+         for the GTK+ 2.x port */
+      printf (_("Error converting string '%s' to current locale from UTF-8: %s\n"),
+              str, error->message);
       return (NULL);
     }