Mercurial > gftp.yaz
changeset 566:502a126418cd
2004-9-26 Brian Masney <masneyb@gftp.org>
* lib/protocols.c (gftp_put_file) - use g_filename_from_utf8() to
change the encoding of the filename (if needed)
author | masneyb |
---|---|
date | Mon, 27 Sep 2004 00:12:11 +0000 |
parents | 5268de53a52a |
children | b505daaccb92 |
files | ChangeLog lib/protocols.c |
diffstat | 2 files changed, 30 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Sat Sep 25 12:50:59 2004 +0000 +++ b/ChangeLog Mon Sep 27 00:12:11 2004 +0000 @@ -1,3 +1,7 @@ +2004-9-26 Brian Masney <masneyb@gftp.org> + * lib/protocols.c (gftp_put_file) - use g_filename_from_utf8() to + change the encoding of the filename (if needed) + 2004-9-22 Brian Masney <masneyb@gftp.org> * src/gtk/gftp-gtk.c - removed ellipsis from menu items that do not require user input. This makes it conform to GNOME HIG. @@ -2852,7 +2856,7 @@ * cvsclean - added this script - * *.[ch] - added $Id: ChangeLog,v 1.327 2004/09/23 01:13:37 masneyb Exp $ tags + * *.[ch] - added $Id: ChangeLog,v 1.328 2004/09/27 00:12:10 masneyb Exp $ tags * debian/* - updated files from Debian maintainer
--- a/lib/protocols.c Sat Sep 25 12:50:59 2004 +0000 +++ b/lib/protocols.c Mon Sep 27 00:12:11 2004 +0000 @@ -187,12 +187,36 @@ gftp_put_file (gftp_request * request, const char *filename, int fd, off_t startsize, off_t totalsize) { + char *tempstr, *enc_filename; + gsize bread, bwrite; + GError * error; + int ret; + g_return_val_if_fail (request != NULL, GFTP_EFATAL); request->cached = 0; if (request->put_file == NULL) return (GFTP_EFATAL); - return (request->put_file (request, filename, fd, startsize, totalsize)); + + if (g_utf8_validate (filename, -1, NULL)) + enc_filename = g_filename_from_utf8 (filename, -1, &bread, &bwrite, &error); + else + { + tempstr = gftp_string_to_utf8 (request, filename); + enc_filename = g_filename_from_utf8 (tempstr, -1, &bread, &bwrite, + &error); + g_free (tempstr); + } + + if (enc_filename) + { + ret = request->put_file (request, enc_filename, fd, startsize, totalsize); + g_free (enc_filename); + } + else + ret = request->put_file (request, filename, fd, startsize, totalsize); + + return (ret); }