Mercurial > gftp.yaz
diff lib/misc.c @ 843:32dbed7e0dc4
2006-11-2 Brian Masney <masneyb@gftp.org>
* lib/local.c lib/misc.c lib/sshv2.c - more improvements to make sure
that the filename is encoded in the proper character set.
author | masneyb |
---|---|
date | Fri, 03 Nov 2006 02:35:47 +0000 |
parents | 57aad6d4b304 |
children | 8263cc35c027 |
line wrap: on
line diff
--- a/lib/misc.c Fri Nov 03 02:01:16 2006 +0000 +++ b/lib/misc.c Fri Nov 03 02:35:47 2006 +0000 @@ -874,6 +874,7 @@ char *file_prefixstr, char *file_suffixstr) { char *tempstr1, *tempstr2, *ret, tstr[50], *attribs, *utf8; + int old_encoding; size_t destlen; struct tm *lt; time_t t; @@ -901,11 +902,19 @@ if (file_suffixstr == NULL) file_suffixstr = ""; + old_encoding = request->use_local_encoding; utf8 = gftp_string_from_utf8 (request, fle->file, &destlen); - ret = g_strdup_printf ("%s %s %s %s%s%s", tempstr1, tempstr2, tstr, - file_prefixstr, - utf8 != NULL ? utf8: fle->file, - file_suffixstr); + request->use_local_encoding = old_encoding; + + if (utf8 != NULL) + { + ret = g_strdup_printf ("%s %s %s %s%s%s", tempstr1, tempstr2, tstr, + file_prefixstr, utf8, file_suffixstr); + g_free (utf8); + } + else + ret = g_strdup_printf ("%s %s %s %s%s%s", tempstr1, tempstr2, tstr, + file_prefixstr, fle->file, file_suffixstr); g_free (tempstr1); g_free (tempstr2);