comparison lib/misc.c @ 845:8263cc35c027

2006-11-2 Brian Masney <masneyb@gftp.org> * lib/gftp.h lib/local.c lib/misc.c lib/protocols.c lib/rfc959.c lib/sshv2.c - added gftp_filename_to_utf8() and gftp_filename_from_utf8(). (gftp_string_from_utf8) - added argument that will force the local encoding to be used.
author masneyb
date Fri, 03 Nov 2006 03:02:51 +0000
parents 32dbed7e0dc4
children 5e3005923374
comparison
equal deleted inserted replaced
844:1ece208d1357 845:8263cc35c027
872 char * 872 char *
873 gftp_gen_ls_string (gftp_request * request, gftp_file * fle, 873 gftp_gen_ls_string (gftp_request * request, gftp_file * fle,
874 char *file_prefixstr, char *file_suffixstr) 874 char *file_prefixstr, char *file_suffixstr)
875 { 875 {
876 char *tempstr1, *tempstr2, *ret, tstr[50], *attribs, *utf8; 876 char *tempstr1, *tempstr2, *ret, tstr[50], *attribs, *utf8;
877 int old_encoding;
878 size_t destlen; 877 size_t destlen;
879 struct tm *lt; 878 struct tm *lt;
880 time_t t; 879 time_t t;
881 880
882 lt = localtime (&fle->datetime); 881 lt = localtime (&fle->datetime);
900 if (file_prefixstr == NULL) 899 if (file_prefixstr == NULL)
901 file_prefixstr = ""; 900 file_prefixstr = "";
902 if (file_suffixstr == NULL) 901 if (file_suffixstr == NULL)
903 file_suffixstr = ""; 902 file_suffixstr = "";
904 903
905 old_encoding = request->use_local_encoding; 904 utf8 = gftp_string_from_utf8 (request, 1, fle->file, &destlen);
906 utf8 = gftp_string_from_utf8 (request, fle->file, &destlen);
907 request->use_local_encoding = old_encoding;
908
909 if (utf8 != NULL) 905 if (utf8 != NULL)
910 { 906 {
911 ret = g_strdup_printf ("%s %s %s %s%s%s", tempstr1, tempstr2, tstr, 907 ret = g_strdup_printf ("%s %s %s %s%s%s", tempstr1, tempstr2, tstr,
912 file_prefixstr, utf8, file_suffixstr); 908 file_prefixstr, utf8, file_suffixstr);
913 g_free (utf8); 909 g_free (utf8);