diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2001-10-28 07:30:07 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2001-10-28 07:30:07 +0800 |
commit | 6cf3eed5909ede44c085e81d2a822455973f2fa9 (patch) | |
tree | 0c6883e9bdb229c4acc8c2496a96660f00227d29 /mail | |
parent | d109123edcdc7edc2d07298f23a7045bd14bf92a (diff) | |
download | gsoc2013-evolution-6cf3eed5909ede44c085e81d2a822455973f2fa9.tar.gz gsoc2013-evolution-6cf3eed5909ede44c085e81d2a822455973f2fa9.tar.zst gsoc2013-evolution-6cf3eed5909ede44c085e81d2a822455973f2fa9.zip |
Allow the user to shoot him/herself in the foot when overriding message
2001-10-27 Jeffrey Stedfast <fejj@ximian.com>
* mail-format.c (mail_format_get_data_wrapper_text): Allow the
user to shoot him/herself in the foot when overriding message
charsets. Permanantly fixes bug #921.
svn path=/trunk/; revision=14240
Diffstat (limited to 'mail')
-rw-r--r-- | mail/ChangeLog | 6 | ||||
-rw-r--r-- | mail/mail-format.c | 25 |
2 files changed, 30 insertions, 1 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index 631fed11d4..9f4208cdb6 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,9 @@ +2001-10-27 Jeffrey Stedfast <fejj@ximian.com> + + * mail-format.c (mail_format_get_data_wrapper_text): Allow the + user to shoot him/herself in the foot when overriding message + charsets. Permanantly fixes bug #921. + 2001-10-26 Dan Winship <danw@ximian.com> * folder-browser.c (etree_key): Work around something that we diff --git a/mail/mail-format.c b/mail/mail-format.c index 91343af07b..96d95698b9 100644 --- a/mail/mail-format.c +++ b/mail/mail-format.c @@ -1060,10 +1060,33 @@ mail_format_get_data_wrapper_text (CamelDataWrapper *wrapper, MailDisplay *mail_ filtered_stream = camel_stream_filter_new_with_stream (memstream); camel_object_unref (CAMEL_OBJECT (memstream)); - if (wrapper->rawtext) { + if (wrapper->rawtext || (mail_display && mail_display->charset)) { CamelMimeFilterCharset *filter; const char *charset; + 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 = content_type ? header_content_type_param (content_type, "charset") : NULL; + if (!charset) + charset = mail_config_get_default_charset (); + + /* since the content is already in UTF-8, we need to decode into the + original charset before we can convert back to UTF-8 using the charset + the user is overriding with... */ + filter = camel_mime_filter_charset_new_convert ("utf-8", charset); + if (filter) { + camel_stream_filter_add (filtered_stream, CAMEL_MIME_FILTER (filter)); + camel_object_unref (CAMEL_OBJECT (filter)); + } + } + + /* find out the charset the user wants to override to */ if (mail_display && mail_display->charset) charset = mail_display->charset; else |