aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2001-09-26 04:49:26 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2001-09-26 04:49:26 +0800
commit6dc2b5fac8deaa57b0a84f74dec98476a3066849 (patch)
tree1b8ddb0773a4a725454c69cfe391c4eceea11f6c /mail
parent7b570acd6bec5c4619e79686c659c30918ea7ea6 (diff)
downloadgsoc2013-evolution-6dc2b5fac8deaa57b0a84f74dec98476a3066849.tar
gsoc2013-evolution-6dc2b5fac8deaa57b0a84f74dec98476a3066849.tar.gz
gsoc2013-evolution-6dc2b5fac8deaa57b0a84f74dec98476a3066849.tar.bz2
gsoc2013-evolution-6dc2b5fac8deaa57b0a84f74dec98476a3066849.tar.lz
gsoc2013-evolution-6dc2b5fac8deaa57b0a84f74dec98476a3066849.tar.xz
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')
-rw-r--r--mail/ChangeLog4
-rw-r--r--mail/mail-format.c18
2 files changed, 21 insertions, 1 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 37bbec983f..0a9670b38f 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,5 +1,9 @@
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.
+
* component-factory.c (owner_set_cb): Throw up a warning dialog if
we suspect the config database is corrupt.
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;