Mercurial > gftp.yaz
diff lib/protocols.c @ 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 | 5df46f79d9c1 |
line wrap: on
line diff
--- 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); }