18110
|
1 |
--- gftp-2.0.19/lib/charset-conv.c.orig 2008-12-09 16:23:18.656150736 +0900
|
|
2 |
+++ gftp-2.0.19/lib/charset-conv.c 2008-12-09 16:32:03.088367844 +0900
|
|
3 |
@@ -35,7 +35,7 @@ _gftp_get_next_charset (char **curpos)
|
|
4 |
for (; **curpos == ' ' || **curpos == '\t'; (*curpos)++);
|
|
5 |
|
|
6 |
if ((endpos = strchr (*curpos, ',')) == NULL)
|
|
7 |
- len = strlen (*curpos) - 1; /* the trailing ',' should be omitted */
|
|
8 |
+ len = strlen (*curpos);
|
|
9 |
else
|
|
10 |
len = endpos - *curpos;
|
|
11 |
|
|
12 |
@@ -46,6 +46,7 @@ _gftp_get_next_charset (char **curpos)
|
|
13 |
retlen++; /* Needed due to the len - 1 above... */
|
|
14 |
ret = g_malloc0 (retlen + 1);
|
|
15 |
memcpy (ret, *curpos, retlen);
|
|
16 |
+ ret[retlen] = '\0';
|
|
17 |
|
|
18 |
for (*curpos += len; **curpos == ','; (*curpos)++);
|
|
19 |
|
|
20 |
@@ -70,7 +71,7 @@ _do_show_iconv_error (const char *str, c
|
|
21 |
toset = "UTF-8";
|
|
22 |
}
|
|
23 |
|
|
24 |
- printf (_("Error converting string '%s' from character set %s to character set %s: %s\n"),
|
|
25 |
+ g_print (_("Error converting string '%s' from character set %s to character set %s: %s\n"),
|
|
26 |
str, fromset, toset, error->message);
|
|
27 |
}
|
|
28 |
|
|
29 |
@@ -80,13 +81,15 @@ _do_convert_string (gftp_request * reque
|
|
30 |
const char *str, size_t *dest_len, int from_utf8)
|
|
31 |
{
|
|
32 |
char *remote_charsets, *ret, *fromset, *toset, *stpos, *cur_charset;
|
|
33 |
+ static const char *local_charset = NULL;
|
|
34 |
GError * error;
|
|
35 |
gsize bread;
|
|
36 |
|
|
37 |
if (request == NULL)
|
|
38 |
return (NULL);
|
|
39 |
|
|
40 |
- if (g_utf8_validate (str, -1, NULL) != from_utf8)
|
|
41 |
+ if (g_utf8_validate (str, -1, NULL) != from_utf8 &&
|
|
42 |
+ request->use_local_encoding == 0)
|
|
43 |
return (NULL);
|
|
44 |
|
|
45 |
error = NULL;
|
|
46 |
@@ -110,7 +113,11 @@ _do_convert_string (gftp_request * reque
|
|
47 |
}
|
|
48 |
|
|
49 |
if (ret == NULL)
|
|
50 |
- _do_show_iconv_error (str, request->iconv_charset, from_utf8, error);
|
|
51 |
+ {
|
|
52 |
+ if (local_charset == NULL)
|
|
53 |
+ g_get_charset (&local_charset);
|
|
54 |
+ _do_show_iconv_error (str, (char*)local_charset, from_utf8, error);
|
|
55 |
+ }
|
|
56 |
|
|
57 |
return (ret);
|
|
58 |
}
|
|
59 |
--- gftp-2.0.19/src/gtk/misc-gtk.c.orig 2008-12-09 16:23:18.675261644 +0900
|
|
60 |
+++ gftp-2.0.19/src/gtk/misc-gtk.c 2008-12-09 16:30:16.958142944 +0900
|
|
61 |
@@ -71,7 +71,8 @@ ftp_log (gftp_logging_level level, gftp_
|
|
62 |
va_end (argp);
|
|
63 |
|
|
64 |
#if GTK_MAJOR_VERSION > 1
|
|
65 |
- if ((utf8_str = gftp_string_to_utf8 (request, logstr, &destlen)) != NULL)
|
|
66 |
+ if (g_utf8_validate (logstr, -1, NULL) != TRUE &&
|
|
67 |
+ (utf8_str = gftp_string_to_utf8 (request, logstr, &destlen)) != NULL)
|
|
68 |
{
|
|
69 |
if (free_logstr)
|
|
70 |
g_free (logstr);
|