2005-09-18 [colin] 1.9.14cvs39
authorColin Leroy <colin@colino.net>
Sun, 18 Sep 2005 01:05:42 +0000 (01:05 +0000)
committerColin Leroy <colin@colino.net>
Sun, 18 Sep 2005 01:05:42 +0000 (01:05 +0000)
* src/codeconv.c
* src/compose.c
* src/procmime.c
More charsets fixes. Fixes bug #806 (non
ascii characters in subject line)

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

index 46f2b462205ed11fe31eb629d3bd2678d19065ff..de6c10535b723de67a6a9eacff11badc2e97d811 100644 (file)
@@ -1,3 +1,11 @@
+2005-09-18 [colin]     1.9.14cvs39
+
+       * src/codeconv.c
+       * src/compose.c
+       * src/procmime.c
+               More charsets fixes. Fixes bug #806 (non
+               ascii characters in subject line)
+
 2005-09-17 [paul]      1.9.14cvs38
 
        * src/folderview.c
index 32ea7f752d55b9e4469496e952c68a34b67304da..750c4d6a6d570da7d179ea2978c7e4d238995672 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.60.2.22 -r 1.60.2.23 src/prefs_actions.c;  cvs diff -u -r 1.16.2.13 -r 1.16.2.14 src/prefs_customheader.c;  cvs diff -u -r 1.16.2.13 -r 1.16.2.14 src/prefs_display_header.c;  cvs diff -u -r 1.1.4.18 -r 1.1.4.19 src/prefs_filtering_action.c;  cvs diff -u -r 1.43.2.23 -r 1.43.2.24 src/prefs_matcher.c;  cvs diff -u -r 1.30.2.16 -r 1.30.2.17 src/prefs_toolbar.c;  ) > 1.9.14cvs36.patchset
 ( cvs diff -u -r 1.28.2.9 -r 1.28.2.10 src/addrindex.c;  ) > 1.9.14cvs37.patchset
 ( cvs diff -u -r 1.207.2.63 -r 1.207.2.64 src/folderview.c;  cvs diff -u -r 1.274.2.65 -r 1.274.2.66 src/mainwindow.c;  ) > 1.9.14cvs38.patchset
+( cvs diff -u -r 1.65.2.35 -r 1.65.2.36 src/codeconv.c;  cvs diff -u -r 1.382.2.170 -r 1.382.2.171 src/compose.c;  cvs diff -u -r 1.49.2.60 -r 1.49.2.61 src/procmime.c;  ) > 1.9.14cvs39.patchset
index 01c9f60ea9a1519a371f71dddbc8e6d78412e175..5d484f3e68fa567fd4e8de79f60edf49d10e9491 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=9
 MICRO_VERSION=14
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=38
+EXTRA_VERSION=39
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index f02603d58a069482292ab0e5fe196b35423d604b..3e7676b11b0f82f822078b61b471729c888348ec 100644 (file)
@@ -672,9 +672,12 @@ void conv_localetodisp(gchar *outbuf, gint outlen, const gchar *inbuf)
 
        tmpstr = conv_iconv_strdup(inbuf, conv_get_locale_charset_str(),
                                   CS_INTERNAL);
-       if (tmpstr) {
+       if (tmpstr && g_utf8_validate(tmpstr, -1, NULL)) {
                strncpy2(outbuf, tmpstr, outlen);
                g_free(tmpstr);
+       } else if (tmpstr && !g_utf8_validate(tmpstr, -1, NULL)) {
+               g_free(tmpstr);
+               conv_utf8todisp(outbuf, outlen, inbuf);
        } else
                conv_utf8todisp(outbuf, outlen, inbuf);
 }
index 78e132d217ec99dc173488751651bdff3cb72a3b..92530ce5f723d92a09a04336e852c4645ebde746 100644 (file)
@@ -4370,6 +4370,7 @@ static gchar *compose_get_header(Compose *compose)
 
        /* Subject */
        str = gtk_editable_get_chars(GTK_EDITABLE(compose->subject_entry), 0, -1);
+
        if (*str != '\0' && !IS_IN_CUSTOM_HEADER("Subject")) {
                g_strstrip(str);
                if (*str != '\0') {
@@ -4550,6 +4551,12 @@ static void compose_convert_header(Compose *compose, gchar *dest, gint len, gcha
        subst_char(tmpstr, '\r', ' ');
        g_strchomp(tmpstr);
 
+       if (!g_utf8_validate(tmpstr, -1, NULL)) {
+               gchar *mybuf = g_malloc(strlen(tmpstr)*2 +1);
+               conv_localetodisp(mybuf, strlen(tmpstr)*2 +1, tmpstr);
+               g_free(tmpstr);
+               tmpstr = mybuf;
+       }
        conv_encode_header_full(dest, len, tmpstr, header_len, addr_field, 
                conv_get_charset_str(compose->out_encoding));
        g_free(tmpstr);
index d01dd2433d5f963e4758aca5cd6eb9dacad51b5c..a9f1a4d4887f9ec8002c1f06f33fc531b803ea79 100644 (file)
@@ -1612,10 +1612,16 @@ static void procmime_parse_content_type(const gchar *content_type, MimeInfo *mim
                mimeinfo->type = MIMETYPE_TEXT;
                mimeinfo->subtype = g_strdup("plain");
                if (g_hash_table_lookup(mimeinfo->typeparameters,
-                                      "charset") == NULL)
-                       g_hash_table_insert(mimeinfo->typeparameters,
+                                      "charset") == NULL) {
+                       if (strcmp(conv_get_locale_charset_str(), CS_UTF_8))
+                               g_hash_table_insert(mimeinfo->typeparameters,
                                            g_strdup("charset"),
                                            g_strdup(conv_get_locale_charset_str()));
+                       else
+                               g_hash_table_insert(mimeinfo->typeparameters,
+                                           g_strdup("charset"),
+                                           g_strdup(CS_ISO_8859_1));
+               }
        } else {
                gchar *type, *subtype, *params;
 
@@ -1716,9 +1722,16 @@ int procmime_parse_mimepart(MimeInfo *parent,
                mimeinfo->type = MIMETYPE_TEXT;
                mimeinfo->subtype = g_strdup("plain");
                if (g_hash_table_lookup(mimeinfo->typeparameters,
-                                      "charset") == NULL)
-                       g_hash_table_insert(mimeinfo->typeparameters, g_strdup("charset"), 
-                               g_strdup(conv_get_locale_charset_str()));
+                                      "charset") == NULL) {
+                       if (strcmp(conv_get_locale_charset_str(), CS_UTF_8))
+                               g_hash_table_insert(mimeinfo->typeparameters,
+                                           g_strdup("charset"),
+                                           g_strdup(conv_get_locale_charset_str()));
+                       else
+                               g_hash_table_insert(mimeinfo->typeparameters,
+                                           g_strdup("charset"),
+                                           g_strdup(CS_ISO_8859_1));
+               }
        }
 
        if (content_encoding != NULL) {