Line
Link Here
|
0 |
-- gftp-2.0.18.orig/lib/gftp.h |
0 |
++ gftp-2.0.18/lib/gftp.h |
Lines 497-504
Link Here
|
497 |
#endif |
497 |
#endif |
498 |
|
498 |
|
499 |
#if GLIB_MAJOR_VERSION > 1 |
499 |
#if GLIB_MAJOR_VERSION > 1 |
500 |
GIConv iconv; |
500 |
GIConv to_utf8_iconv; |
501 |
unsigned int iconv_initialized : 1; |
501 |
GIConv from_utf8_iconv; |
|
|
502 |
unsigned int to_utf8_iconv_initialized : 1; |
503 |
unsigned int from_utf8_iconv_initialized : 1; |
502 |
#endif |
504 |
#endif |
503 |
}; |
505 |
}; |
504 |
|
506 |
|
505 |
-- gftp-2.0.18.orig/lib/protocols.c |
507 |
++ gftp-2.0.18/lib/protocols.c |
Lines 159-168
Link Here
|
159 |
#endif |
159 |
#endif |
160 |
|
160 |
|
161 |
#if GLIB_MAJOR_VERSION > 1 |
161 |
#if GLIB_MAJOR_VERSION > 1 |
162 |
if (request->iconv_initialized) |
162 |
if (request->to_utf8_iconv_initialized) |
163 |
{ |
163 |
{ |
164 |
g_iconv_close (request->iconv); |
164 |
g_iconv_close (request->to_utf8_iconv); |
165 |
request->iconv_initialized = 0; |
165 |
request->to_utf8_iconv_initialized = 0; |
|
|
166 |
} |
167 |
if (request->from_utf8_iconv_initialized) |
168 |
{ |
169 |
g_iconv_close (request->from_utf8_iconv); |
170 |
request->from_utf8_iconv_initialized = 0; |
166 |
} |
171 |
} |
167 |
#endif |
172 |
#endif |
168 |
|
173 |
|
Lines 446-454
Link Here
|
446 |
|
451 |
|
447 |
if (g_utf8_validate (str, -1, NULL)) |
452 |
if (g_utf8_validate (str, -1, NULL)) |
448 |
return (NULL); |
453 |
return (NULL); |
449 |
else if (request->iconv_initialized) |
454 |
else if( request->protonum == GFTP_LOCAL_NUM ){ |
|
|
455 |
/* if request represents local file system */ |
456 |
return g_filename_to_utf8( str, -1, NULL, NULL, NULL ); |
457 |
} |
458 |
else if (request->to_utf8_iconv_initialized) |
450 |
{ |
459 |
{ |
451 |
ret = g_convert_with_iconv (str, -1, request->iconv, &bread, &bwrite, |
460 |
ret = g_convert_with_iconv (str, -1, request->to_utf8_iconv, &bread, &bwrite, |
452 |
&error); |
461 |
&error); |
453 |
if (ret == NULL) |
462 |
if (ret == NULL) |
454 |
printf (_("Error converting string '%s' from character set %s to character set %s: %s\n"), |
463 |
printf (_("Error converting string '%s' from character set %s to character set %s: %s\n"), |
Lines 476-502
Link Here
|
476 |
stpos = remote_charsets; |
485 |
stpos = remote_charsets; |
477 |
while ((cur_charset = _gftp_get_next_charset (&stpos)) != NULL) |
486 |
while ((cur_charset = _gftp_get_next_charset (&stpos)) != NULL) |
478 |
{ |
487 |
{ |
479 |
if ((request->iconv = g_iconv_open ("UTF-8", cur_charset)) == (GIConv) -1) |
488 |
if ((request->to_utf8_iconv = g_iconv_open ("UTF-8", cur_charset)) == (GIConv) -1) |
480 |
continue; |
489 |
continue; |
481 |
|
490 |
|
482 |
error = NULL; |
491 |
error = NULL; |
483 |
if ((ret = g_convert_with_iconv (str, -1, request->iconv, &bread, &bwrite, |
492 |
if ((ret = g_convert_with_iconv (str, -1, request->to_utf8_iconv, &bread, &bwrite, |
484 |
&error)) == NULL) |
493 |
&error)) == NULL) |
485 |
{ |
494 |
{ |
486 |
printf (_("Error converting string '%s' from character set %s to character set %s: %s\n"), |
495 |
printf (_("Error converting string '%s' from character set %s to character set %s: %s\n"), |
487 |
str, cur_charset, "UTF-8", error->message); |
496 |
str, cur_charset, "UTF-8", error->message); |
488 |
|
497 |
|
489 |
g_iconv_close (request->iconv); |
498 |
g_iconv_close (request->to_utf8_iconv); |
490 |
request->iconv = NULL; |
499 |
request->to_utf8_iconv = NULL; |
491 |
continue; |
500 |
continue; |
492 |
} |
501 |
} |
493 |
else |
502 |
else |
494 |
{ |
503 |
{ |
495 |
request->iconv_initialized = 1; |
504 |
request->to_utf8_iconv_initialized = 1; |
496 |
break; |
505 |
break; |
497 |
} |
506 |
} |
498 |
} |
507 |
} |
499 |
|
|
|
500 |
g_free (remote_charsets); |
508 |
g_free (remote_charsets); |
501 |
|
509 |
|
502 |
return (ret); |
510 |
return (ret); |
Lines 517-525
Link Here
|
517 |
locale... */ |
525 |
locale... */ |
518 |
if (!g_utf8_validate (str, -1, NULL)) |
526 |
if (!g_utf8_validate (str, -1, NULL)) |
519 |
return (NULL); |
527 |
return (NULL); |
520 |
else if (request->iconv_initialized) |
528 |
else if( request->protonum == GFTP_LOCAL_NUM ){ |
|
|
529 |
/* if request represents local file system */ |
530 |
return g_filename_from_utf8( str, -1, NULL, NULL, NULL ); |
531 |
} |
532 |
else if (request->from_utf8_iconv_initialized) |
521 |
{ |
533 |
{ |
522 |
ret = g_convert_with_iconv (str, -1, request->iconv, &bread, &bwrite, |
534 |
ret = g_convert_with_iconv (str, -1, request->from_utf8_iconv, &bread, &bwrite, |
523 |
&error); |
535 |
&error); |
524 |
if (ret == NULL) |
536 |
if (ret == NULL) |
525 |
printf (_("Error converting string '%s' from character set %s to character set %s: %s\n"), |
537 |
printf (_("Error converting string '%s' from character set %s to character set %s: %s\n"), |
Lines 547-569
Link Here
|
547 |
stpos = remote_charsets; |
559 |
stpos = remote_charsets; |
548 |
while ((cur_charset = _gftp_get_next_charset (&stpos)) != NULL) |
560 |
while ((cur_charset = _gftp_get_next_charset (&stpos)) != NULL) |
549 |
{ |
561 |
{ |
550 |
if ((request->iconv = g_iconv_open (cur_charset, "UTF-8")) == (GIConv) -1) |
562 |
if ((request->from_utf8_iconv = g_iconv_open (cur_charset, "UTF-8")) == (GIConv) -1) |
551 |
continue; |
563 |
continue; |
552 |
|
|
|
553 |
error = NULL; |
564 |
error = NULL; |
554 |
if ((ret = g_convert_with_iconv (str, -1, request->iconv, &bread, &bwrite, |
565 |
if ((ret = g_convert_with_iconv (str, -1, request->from_utf8_iconv, &bread, &bwrite, |
555 |
&error)) == NULL) |
566 |
&error)) == NULL) |
556 |
{ |
567 |
{ |
557 |
printf (_("Error converting string '%s' from character set %s to character set %s: %s\n"), |
568 |
printf (_("Error converting string '%s' from character set %s to character set %s: %s\n"), |
558 |
str, "UTF-8", cur_charset, error->message); |
569 |
str, "UTF-8", cur_charset, error->message); |
559 |
|
570 |
|
560 |
g_iconv_close (request->iconv); |
571 |
g_iconv_close (request->from_utf8_iconv); |
561 |
request->iconv = NULL; |
572 |
request->from_utf8_iconv = NULL; |
562 |
continue; |
573 |
continue; |
563 |
} |
574 |
} |
564 |
else |
575 |
else |
565 |
{ |
576 |
{ |
566 |
request->iconv_initialized = 1; |
577 |
request->from_utf8_iconv_initialized = 1; |
567 |
break; |
578 |
break; |
568 |
} |
579 |
} |
569 |
} |
580 |
} |
Lines 1915-1920
Link Here
|
1915 |
gftp_file * fle; |
1926 |
gftp_file * fle; |
1916 |
off_t *newsize; |
1927 |
off_t *newsize; |
1917 |
char *newname; |
1928 |
char *newname; |
|
|
1929 |
char* destname; |
1918 |
|
1930 |
|
1919 |
if (getothdir && transfer->toreq) |
1931 |
if (getothdir && transfer->toreq) |
1920 |
{ |
1932 |
{ |
Lines 1944-1953
Link Here
|
1944 |
fle->startsize = *newsize; |
1956 |
fle->startsize = *newsize; |
1945 |
|
1957 |
|
1946 |
if (transfer->toreq && fle->destfile == NULL) |
1958 |
if (transfer->toreq && fle->destfile == NULL) |
|
|
1959 |
{ |
1960 |
destname = (fle->utf8_file ? fle->utf8_file : fle->file); |
1961 |
destname = gftp_string_from_utf8( transfer->toreq, |
1962 |
destname ); |
1947 |
fle->destfile = gftp_build_path (transfer->toreq, |
1963 |
fle->destfile = gftp_build_path (transfer->toreq, |
1948 |
transfer->toreq->directory, |
1964 |
transfer->toreq->directory, |
1949 |
fle->file, NULL); |
1965 |
destname, NULL); |
1950 |
|
1966 |
g_free( destname ); |
|
|
1967 |
} |
1968 |
|
1951 |
if (transfer->fromreq->directory != NULL && |
1969 |
if (transfer->fromreq->directory != NULL && |
1952 |
*transfer->fromreq->directory != '\0' && |
1970 |
*transfer->fromreq->directory != '\0' && |
1953 |
*fle->file != '/') |
1971 |
*fle->file != '/') |
Lines 1986-1991
Link Here
|
1986 |
gftp_file * curfle; |
2004 |
gftp_file * curfle; |
1987 |
off_t *newsize; |
2005 |
off_t *newsize; |
1988 |
mode_t st_mode; |
2006 |
mode_t st_mode; |
|
|
2007 |
char* utf8; |
2008 |
char* destname; |
1989 |
|
2009 |
|
1990 |
g_return_val_if_fail (transfer != NULL, GFTP_EFATAL); |
2010 |
g_return_val_if_fail (transfer != NULL, GFTP_EFATAL); |
1991 |
g_return_val_if_fail (transfer->fromreq != NULL, GFTP_EFATAL); |
2011 |
g_return_val_if_fail (transfer->fromreq != NULL, GFTP_EFATAL); |
Lines 2004-2018
Link Here
|
2004 |
for (lastlist = transfer->files; ; lastlist = lastlist->next) |
2024 |
for (lastlist = transfer->files; ; lastlist = lastlist->next) |
2005 |
{ |
2025 |
{ |
2006 |
curfle = lastlist->data; |
2026 |
curfle = lastlist->data; |
2007 |
|
2027 |
utf8 = curfle->utf8_file ? curfle->utf8_file : curfle->file; |
2008 |
if ((pos = strrchr (curfle->file, '/')) != NULL) |
2028 |
if ((pos = strrchr (utf8, '/')) != NULL) |
2009 |
pos++; |
2029 |
pos++; |
2010 |
else |
2030 |
else |
2011 |
pos = curfle->file; |
2031 |
pos = utf8; |
2012 |
|
2032 |
|
2013 |
if (dirhash != NULL && |
2033 |
destname = gftp_string_from_utf8( transfer->toreq, pos ); |
2014 |
(newsize = g_hash_table_lookup (dirhash, pos)) != NULL) |
2034 |
if( destname ) { |
2015 |
curfle->startsize = *newsize; |
2035 |
if (dirhash != NULL && |
|
|
2036 |
(newsize = g_hash_table_lookup (dirhash, destname)) != NULL) { |
2037 |
curfle->startsize = *newsize; |
2038 |
} |
2039 |
g_free( destname ); |
2040 |
} |
2041 |
else{ |
2042 |
curfle->startsize = 0; |
2043 |
} |
2016 |
|
2044 |
|
2017 |
if (curfle->size < 0 && GFTP_IS_CONNECTED (transfer->fromreq)) |
2045 |
if (curfle->size < 0 && GFTP_IS_CONNECTED (transfer->fromreq)) |
2018 |
{ |
2046 |
{ |
Lines 2022-2030
Link Here
|
2022 |
} |
2050 |
} |
2023 |
|
2051 |
|
2024 |
if (transfer->toreq && curfle->destfile == NULL) |
2052 |
if (transfer->toreq && curfle->destfile == NULL) |
|
|
2053 |
{ |
2054 |
destname = gftp_string_from_utf8( transfer->toreq, utf8 ); |
2025 |
curfle->destfile = gftp_build_path (transfer->toreq, |
2055 |
curfle->destfile = gftp_build_path (transfer->toreq, |
2026 |
transfer->toreq->directory, |
2056 |
transfer->toreq->directory, |
2027 |
curfle->file, NULL); |
2057 |
destname, NULL); |
|
|
2058 |
g_free( destname ); |
2059 |
} |
2028 |
|
2060 |
|
2029 |
if (transfer->fromreq->directory != NULL && |
2061 |
if (transfer->fromreq->directory != NULL && |
2030 |
*transfer->fromreq->directory != '\0' && *curfle->file != '/') |
2062 |
*transfer->fromreq->directory != '\0' && *curfle->file != '/') |
2031 |
-- gftp-2.0.18.orig/src/gtk/gtkui.c |
2063 |
++ gftp-2.0.18/src/gtk/gtkui.c |
Lines 335-340
Link Here
|
335 |
gftp_window_data * wdata; |
335 |
gftp_window_data * wdata; |
336 |
gftp_file * curfle; |
336 |
gftp_file * curfle; |
337 |
char *tempstr; |
337 |
char *tempstr; |
|
|
338 |
char* utf8_name; |
338 |
int num; |
339 |
int num; |
339 |
|
340 |
|
340 |
wdata = data; |
341 |
wdata = data; |
Lines 352-361
Link Here
|
352 |
templist = get_next_selection (templist, &filelist, &num); |
353 |
templist = get_next_selection (templist, &filelist, &num); |
353 |
curfle = filelist->data; |
354 |
curfle = filelist->data; |
354 |
cdata->source_string = g_strdup (curfle->file); |
355 |
cdata->source_string = g_strdup (curfle->file); |
|
|
356 |
utf8_name = (curfle->utf8_file ? curfle->utf8_file : curfle->file); |
355 |
|
357 |
|
356 |
tempstr = g_strdup_printf (_("What would you like to rename %s to?"), |
358 |
tempstr = g_strdup_printf (_("What would you like to rename %s to?"), |
357 |
cdata->source_string); |
359 |
utf8_name); |
358 |
MakeEditDialog (_("Rename"), tempstr, cdata->source_string, 1, NULL, |
360 |
MakeEditDialog (_("Rename"), tempstr, utf8_name, 1, NULL, |
359 |
gftp_dialog_button_rename, |
361 |
gftp_dialog_button_rename, |
360 |
gftpui_run_function_callback, cdata, |
362 |
gftpui_run_function_callback, cdata, |
361 |
gftpui_run_function_cancel_callback, cdata); |
363 |
gftpui_run_function_cancel_callback, cdata); |