diff options
-rw-r--r-- | capture_opts.c | 5 | ||||
-rw-r--r-- | gtk/main.c | 10 |
2 files changed, 15 insertions, 0 deletions
diff --git a/capture_opts.c b/capture_opts.c index 4b6595fad9..08f023e705 100644 --- a/capture_opts.c +++ b/capture_opts.c @@ -412,7 +412,12 @@ capture_opts_add_opt(capture_options *capture_opts, int opt, const char *optarg, capture_opts->real_time_mode = TRUE; break; case 'w': /* Write to capture file xxx */ +#if defined _WIN32 && (GLIB_MAJOR_VERSION > 2 || (GLIB_MAJOR_VERSION == 2 && GLIB_MINOR_VERSION >= 6)) + /* since GLib 2.6, we need to convert filenames to utf8 for Win32 */ + capture_opts->save_file = g_locale_to_utf8(optarg, -1, NULL, NULL, NULL); +#else capture_opts->save_file = g_strdup(optarg); +#endif capture_opts->output_to_pipe = capture_opts_output_to_pipe(capture_opts->save_file); break; case 'y': /* Set the pcap data link type */ diff --git a/gtk/main.c b/gtk/main.c index 30e3261f7c..30ccf531eb 100644 --- a/gtk/main.c +++ b/gtk/main.c @@ -2284,7 +2284,12 @@ main(int argc, char *argv[]) /* We may set "last_open_dir" to "cf_name", and if we change "last_open_dir" later, we free the old value, so we have to set "cf_name" to something that's been allocated. */ +#if defined _WIN32 && (GLIB_MAJOR_VERSION > 2 || (GLIB_MAJOR_VERSION == 2 && GLIB_MINOR_VERSION >= 6)) + /* since GLib 2.6, we need to convert filenames to utf8 for Win32 */ + cf_name = g_locale_to_utf8(optarg, -1, NULL, NULL, NULL); +#else cf_name = g_strdup(optarg); +#endif break; case 'R': /* Read file filter */ rfilter = optarg; @@ -2345,7 +2350,12 @@ main(int argc, char *argv[]) * file - yes, you could have "-r" as the last part of the command, * but that's a bit ugly. */ +#if defined _WIN32 && (GLIB_MAJOR_VERSION > 2 || (GLIB_MAJOR_VERSION == 2 && GLIB_MINOR_VERSION >= 6)) + /* since GLib 2.6, we need to convert filenames to utf8 for Win32 */ + cf_name = g_locale_to_utf8(argv[0], -1, NULL, NULL, NULL); +#else cf_name = g_strdup(argv[0]); +#endif } argc--; argv++; |