diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | ChangeLog.ja | 6 | ||||
-rw-r--r-- | src/compose.c | 21 |
3 files changed, 27 insertions, 5 deletions
@@ -1,5 +1,10 @@ 2005-07-11 + * src/compose.c: compose_parse_header(): use Content-Type's charset as + a fallback encoding of broken header strings. + +2005-07-11 + * src/compose.c: don't convert encoding if inserted file is UTF-8. 2005-07-11 diff --git a/ChangeLog.ja b/ChangeLog.ja index 50867560..f3c44f89 100644 --- a/ChangeLog.ja +++ b/ChangeLog.ja @@ -1,5 +1,11 @@ 2005-07-11 + * src/compose.c: compose_parse_header(): 不正なヘッダ文字列の + フォールバックエンコーディングとして Content-Type の charset + を使用。 + +2005-07-11 + * src/compose.c: 挿入するファイルが UTF-8 の場合はエンコーディングを 変換しないようにした。 diff --git a/src/compose.c b/src/compose.c index 767b17dd..7dd49543 100644 --- a/src/compose.c +++ b/src/compose.c @@ -1217,6 +1217,7 @@ static gint compose_parse_header(Compose *compose, MsgInfo *msginfo) {"Newsgroups:", NULL, TRUE}, {"Followup-To:", NULL, TRUE}, {"List-Post:", NULL, FALSE}, + {"Content-Type:",NULL, FALSE}, {NULL, NULL, FALSE}}; enum @@ -1227,10 +1228,12 @@ static gint compose_parse_header(Compose *compose, MsgInfo *msginfo) H_BCC = 3, H_NEWSGROUPS = 4, H_FOLLOWUP_TO = 5, - H_LIST_POST = 6 + H_LIST_POST = 6, + H_CONTENT_TYPE = 7 }; FILE *fp; + gchar *charset = NULL; g_return_val_if_fail(msginfo != NULL, -1); @@ -1238,17 +1241,23 @@ static gint compose_parse_header(Compose *compose, MsgInfo *msginfo) procheader_get_header_fields(fp, hentry); fclose(fp); + if (hentry[H_CONTENT_TYPE].body != NULL) { + procmime_scan_content_type_str(hentry[H_CONTENT_TYPE].body, + NULL, &charset, NULL, NULL); + g_free(hentry[H_CONTENT_TYPE].body); + hentry[H_CONTENT_TYPE].body = NULL; + } if (hentry[H_REPLY_TO].body != NULL) { if (hentry[H_REPLY_TO].body[0] != '\0') { compose->replyto = conv_unmime_header(hentry[H_REPLY_TO].body, - NULL); + charset); } g_free(hentry[H_REPLY_TO].body); hentry[H_REPLY_TO].body = NULL; } if (hentry[H_CC].body != NULL) { - compose->cc = conv_unmime_header(hentry[H_CC].body, NULL); + compose->cc = conv_unmime_header(hentry[H_CC].body, charset); g_free(hentry[H_CC].body); hentry[H_CC].body = NULL; } @@ -1265,7 +1274,7 @@ static gint compose_parse_header(Compose *compose, MsgInfo *msginfo) if (hentry[H_BCC].body != NULL) { if (compose->mode == COMPOSE_REEDIT) compose->bcc = - conv_unmime_header(hentry[H_BCC].body, NULL); + conv_unmime_header(hentry[H_BCC].body, charset); g_free(hentry[H_BCC].body); hentry[H_BCC].body = NULL; } @@ -1277,7 +1286,7 @@ static gint compose_parse_header(Compose *compose, MsgInfo *msginfo) if (hentry[H_FOLLOWUP_TO].body[0] != '\0') { compose->followup_to = conv_unmime_header(hentry[H_FOLLOWUP_TO].body, - NULL); + charset); } g_free(hentry[H_FOLLOWUP_TO].body); hentry[H_FOLLOWUP_TO].body = NULL; @@ -1298,6 +1307,8 @@ static gint compose_parse_header(Compose *compose, MsgInfo *msginfo) hentry[H_LIST_POST].body = NULL; } + g_free(charset); + if (compose->mode == COMPOSE_REEDIT) { if (msginfo->inreplyto && *msginfo->inreplyto) compose->inreplyto = g_strdup(msginfo->inreplyto); |