2005-02-17 [colin] 1.0.1cvs11.5
authorColin Leroy <colin@colino.net>
Thu, 17 Feb 2005 08:54:47 +0000 (08:54 +0000)
committerColin Leroy <colin@colino.net>
Thu, 17 Feb 2005 08:54:47 +0000 (08:54 +0000)
* src/codeconv.c
conv_filename_to_utf8: return clean 7bit instead
of broken utf8 if needed
* src/mimeview.c
Fix display of parts with unclean 8bit names

ChangeLog-gtk2.claws
PATCHSETS
configure.ac
src/codeconv.c
src/mimeview.c

index 49ead6e..75a1903 100644 (file)
@@ -1,3 +1,11 @@
+2005-02-17 [colin]     1.0.1cvs11.5
+
+       * src/codeconv.c
+               conv_filename_to_utf8: return clean 7bit instead
+               of broken utf8 if needed
+       * src/mimeview.c
+               Fix display of parts with unclean 8bit names
+
 2005-02-17 [paul]      1.0.1cvs11.4
 
        * src/compose.c
index aa15579..70b6802 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.94.2.45 -r 1.94.2.46 src/messageview.c; ) > 1.0.1cvs11.2.patchset
 ( cvs diff -u -r 1.395.2.52 -r 1.395.2.53 src/summaryview.c; cvs diff -u -r 1.3.2.17 -r 1.3.2.18 src/prefs_themes.c; ) > 1.0.1cvs11.3.patchset
 ( cvs diff -u -r 1.382.2.102 -r 1.382.2.103 src/compose.c; cvs diff -u -r 1.1.4.4 -r 1.1.4.5 src/exportldif.c; cvs diff -u -r 1.25.2.7 -r 1.25.2.8 src/matcher_parser_parse.y; cvs diff -u -r 1.49.2.34 -r 1.49.2.35 src/procmime.c; cvs diff -u -r 1.9.2.11 -r 1.9.2.12 src/sourcewindow.c; cvs diff -u -r 1.24.2.5 -r 1.24.2.6 src/common/Makefile.am; cvs diff -u -r -1.1.4.2 -r -1.1.4.3 src/common/intl.h; cvs diff -u -r 1.1.4.3 -r 1.1.4.4 src/plugins/trayicon/libeggtrayicon/eggtrayicon.c; ) > 1.0.1cvs11.4.patchset
+( cvs diff -u -r 1.65.2.23 -r 1.65.2.24 src/codeconv.c; cvs diff -u -r 1.83.2.31 -r 1.83.2.32 src/mimeview.c; ) > 1.0.1cvs11.5.patchset
index 9123736..860711f 100644 (file)
@@ -13,7 +13,7 @@ INTERFACE_AGE=0
 BINARY_AGE=0
 EXTRA_VERSION=11
 EXTRA_RELEASE=
-EXTRA_GTK2_VERSION=.4
+EXTRA_GTK2_VERSION=.5
 
 if test \( $EXTRA_VERSION -eq 0 \) -o \( "x$EXTRA_RELEASE" != "x" \); then
     VERSION=${MAJOR_VERSION}.${MINOR_VERSION}.${MICRO_VERSION}${EXTRA_RELEASE}${EXTRA_GTK2_VERSION}
index d36bf87..4633d36 100644 (file)
@@ -1805,7 +1805,7 @@ gchar *conv_filename_from_utf8(const gchar *utf8_file)
 
 gchar *conv_filename_to_utf8(const gchar *fs_file)
 {
-       gchar *utf8_file;
+       gchar *utf8_file = NULL;
        GError *error = NULL;
 
        utf8_file = g_filename_to_utf8(fs_file, -1, NULL, NULL, &error);
@@ -1814,8 +1814,12 @@ gchar *conv_filename_to_utf8(const gchar *fs_file)
                          error->message);
                g_error_free(error);
        }
-       if (!utf8_file)
+
+       if (!utf8_file || !g_utf8_validate(utf8_file, -1, NULL)) {
+               g_free(utf8_file);
                utf8_file = g_strdup(fs_file);
+               conv_unreadable_8bit(utf8_file);
+       }
 
        return utf8_file;
 }
index f1c8c84..2e22907 100644 (file)
@@ -992,6 +992,12 @@ gchar *mimeview_get_filename_for_part(MimeInfo *partinfo,
        if (!filename || !*filename)
                filename = g_strdup_printf("noname.%d", number);
 
+       if (!g_utf8_validate(filename, -1, NULL)) {
+               gchar *tmp = conv_filename_to_utf8(filename);
+               g_free(filename);
+               filename = tmp;
+       }
+       
        subst_for_filename(filename);
 
        fullname = g_strconcat
@@ -1134,6 +1140,12 @@ static void mimeview_save_as(MimeView *mimeview)
        }
        partname = g_strdup(get_part_name(partinfo));
        
+       if (!g_utf8_validate(partname, -1, NULL)) {
+               gchar *tmp = conv_filename_to_utf8(partname);
+               g_free(partname);
+               partname = tmp;
+       }
+
        subst_for_filename(partname);
        
        if (prefs_common.attach_save_dir)
@@ -1601,9 +1613,16 @@ static void icon_list_append_icon (MimeView *mimeview, MimeInfo *mimeinfo)
                        to_human_readable(mimeinfo->length), NULL);
        g_free(content_type);
        if (desc && *desc) {
-               tiptmp = g_strjoin("\n", desc, tip, NULL);
+               gchar *tmp = NULL;
+               if (!g_utf8_validate(desc, -1, NULL)) {
+                       tmp = conv_filename_to_utf8(desc);
+               } else {
+                       tmp = g_strdup(desc);
+               }
+               tiptmp = g_strjoin("\n", tmp, tip, NULL);
                g_free(tip);
                tip = tiptmp;
+               g_free(tmp);
        }
        if (sigshort && *sigshort) {
                tiptmp = g_strjoin("\n", tip, sigshort, NULL);