diff options
author | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2005-02-08 09:22:58 +0000 |
---|---|---|
committer | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2005-02-08 09:22:58 +0000 |
commit | 2a790ab66bf113d914c7a6307d6c3092ab0b936a (patch) | |
tree | 7870d07b9c5bc67b89e20d8b4043642299635d41 /src/codeconv.c | |
parent | 3fe4ea91de3aba0cb629de313ed6c41f4c06b385 (diff) |
fixed non-utf8 filename handlings.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@99 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'src/codeconv.c')
-rw-r--r-- | src/codeconv.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/codeconv.c b/src/codeconv.c index 50df350d..c8329681 100644 --- a/src/codeconv.c +++ b/src/codeconv.c @@ -1858,3 +1858,37 @@ gint conv_copy_dir(const gchar *src, const gchar *dest, const gchar *encoding) return 0; } + +gchar *conv_filename_from_utf8(const gchar *utf8_file) +{ + gchar *fs_file; + GError *error = NULL; + + fs_file = g_filename_from_utf8(utf8_file, -1, NULL, NULL, &error); + if (error) { + g_warning("failed to convert encoding of file name: %s\n", + error->message); + g_error_free(error); + } + if (!fs_file) + fs_file = g_strdup(utf8_file); + + return fs_file; +} + +gchar *conv_filename_to_utf8(const gchar *fs_file) +{ + gchar *utf8_file; + GError *error = NULL; + + utf8_file = g_filename_to_utf8(fs_file, -1, NULL, NULL, &error); + if (error) { + g_warning("failed to convert encoding of file name: %s\n", + error->message); + g_error_free(error); + } + if (!utf8_file) + utf8_file = g_strdup(fs_file); + + return utf8_file; +} |