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
This commit is contained in:
Jeffrey Stedfast
2001-09-25 20:49:26 +00:00
committed by Jeffrey Stedfast
parent 7b570acd6b
commit 6dc2b5fac8
2 changed files with 21 additions and 1 deletions

View File

@ -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.

View File

@ -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;