From d7a4a66632cac7424bc158ace966b9ac950f4337 Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Fri, 21 Mar 2003 21:26:06 +0000 Subject: Default to the charset provied in the MimePart's Content-Type over that of 2003-03-21 Jeffrey Stedfast * mail-format.c (mail_format_data_wrapper_write_to_stream): Default to the charset provied in the MimePart's Content-Type over that of the user's mailer charset. Fixes bug #39204. svn path=/trunk/; revision=20462 --- mail/mail-format.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'mail/mail-format.c') diff --git a/mail/mail-format.c b/mail/mail-format.c index 9d4423c1af..562776da16 100644 --- a/mail/mail-format.c +++ b/mail/mail-format.c @@ -1099,19 +1099,20 @@ mail_format_data_wrapper_write_to_stream (CamelDataWrapper *wrapper, MailDisplay if (wrapper->rawtext || (mail_display && mail_display->charset)) { CamelMimeFilterCharset *filter; + CamelContentType *content_type; GConfClient *gconf; char *charset; gconf = gconf_client_get_default (); + content_type = camel_data_wrapper_get_mime_type_field (wrapper); + if (!wrapper->rawtext) { /* data wrapper had been successfully converted to UTF-8 using the mime part's charset, but the user thinks he knows best so we'll let him shoot himself in the foot here... */ - CamelContentType *content_type; /* get the original charset of the mime part */ - content_type = camel_data_wrapper_get_mime_type_field (wrapper); charset = (char *) (content_type ? header_content_type_param (content_type, "charset") : NULL); if (!charset) charset = gconf_client_get_string (gconf, "/apps/evolution/mail/format/charset", NULL); @@ -1132,6 +1133,8 @@ mail_format_data_wrapper_write_to_stream (CamelDataWrapper *wrapper, MailDisplay /* find out the charset the user wants to override to */ if (mail_display && mail_display->charset) charset = g_strdup (mail_display->charset); + else if (content_type && (charset = (char *) header_content_type_param (content_type, "charset"))) + charset = g_strdup (charset); else charset = gconf_client_get_string (gconf, "/apps/evolution/mail/format/charset", NULL); -- cgit v1.2.3