diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2001-09-26 04:49:26 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2001-09-26 04:49:26 +0800 |
commit | 6dc2b5fac8deaa57b0a84f74dec98476a3066849 (patch) | |
tree | 1b8ddb0773a4a725454c69cfe391c4eceea11f6c /mail/mail-format.c | |
parent | 7b570acd6bec5c4619e79686c659c30918ea7ea6 (diff) | |
download | gsoc2013-evolution-6dc2b5fac8deaa57b0a84f74dec98476a3066849.tar.gz gsoc2013-evolution-6dc2b5fac8deaa57b0a84f74dec98476a3066849.tar.zst gsoc2013-evolution-6dc2b5fac8deaa57b0a84f74dec98476a3066849.zip |
If the data wrapper contains raw text, treat the contents as if they were
2001-09-25 Jeffrey Stedfast <fejj@ximian.com>
* mail-format.c (get_data_wrapper_text): If the data wrapper
contains raw text, treat the contents as if they were in the
user's default charset and convert them to UTF-8.
svn path=/trunk/; revision=13119
Diffstat (limited to 'mail/mail-format.c')
-rw-r--r-- | mail/mail-format.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/mail/mail-format.c b/mail/mail-format.c index b1e3f9b5d1..584db2b01c 100644 --- a/mail/mail-format.c +++ b/mail/mail-format.c @@ -1040,15 +1040,31 @@ static char * get_data_wrapper_text (CamelDataWrapper *wrapper) { CamelStream *memstream; + CamelStreamFilter *filtered_stream; GByteArray *ba; char *text, *end; memstream = camel_stream_mem_new (); ba = g_byte_array_new (); camel_stream_mem_set_byte_array (CAMEL_STREAM_MEM (memstream), ba); - camel_data_wrapper_write_to_stream (wrapper, memstream); + + filtered_stream = camel_stream_filter_new_with_stream (memstream); camel_object_unref (CAMEL_OBJECT (memstream)); + if (wrapper->rawtext) { + CamelMimeFilterCharset *filter; + const char *charset; + + charset = mail_config_get_default_charset (); + filter = camel_mime_filter_charset_new_convert (charset, "utf-8"); + camel_stream_filter_add (filtered_stream, CAMEL_MIME_FILTER (filter)); + camel_object_unref (CAMEL_OBJECT (filter)); + } + + camel_data_wrapper_write_to_stream (wrapper, CAMEL_STREAM (filtered_stream)); + camel_stream_flush (CAMEL_STREAM (filtered_stream)); + camel_object_unref (CAMEL_OBJECT (filtered_stream)); + for (text = ba->data, end = text + ba->len; text < end; text++) { if (!isspace ((unsigned char)*text)) break; |