aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--camel/ChangeLog6
-rw-r--r--camel/camel-mime-part.c14
2 files changed, 19 insertions, 1 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index 6c587fe801..90672ffc62 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,5 +1,11 @@
2000-08-31 Not Zed <NotZed@HelixCode.com>
+ * camel-mime-part.c (write_to_stream): Use the proper type
+ checking function to check for text types.
+ (write_to_stream): If we have a charset on a text type that
+ isn't us-ascii or utf-8, then we need to reencode it, so add a
+ filter to do that too.
+
* camel-mime-utils.c (append_latin1): New function - even though
its broken, we'll assume mailers send latin1 headers instead of
us-ascii. We just have to encode high chars into utf-8.
diff --git a/camel/camel-mime-part.c b/camel/camel-mime-part.c
index f9519df5e4..ae33f5c8ce 100644
--- a/camel/camel-mime-part.c
+++ b/camel/camel-mime-part.c
@@ -517,11 +517,23 @@ write_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream)
}
if (filter) {
filter_stream = camel_stream_filter_new_with_stream(stream);
- if (!strcasecmp(mp->content_type->type, "text")) {
+ if (gmime_content_field_is_type(mp->content_type, "text", "*")) {
CamelMimeFilter *crlf = camel_mime_filter_crlf_new(CAMEL_MIME_FILTER_CRLF_ENCODE,
CAMEL_MIME_FILTER_CRLF_MODE_CRLF_ONLY);
+ char *charset;
+
camel_stream_filter_add(filter_stream, crlf);
camel_object_unref((CamelObject *)crlf);
+
+ charset = gmime_content_field_get_parameter(mp->content_type, "charset");
+ if (!(charset == NULL || !strcasecmp(charset, "us-ascii") || !strcasecmp(charset, "utf-8"))) {
+ CamelMimeFilter *charenc;
+ charenc = camel_mime_filter_charset_new("utf-8", charset);
+ camel_stream_filter_add(filter_stream, charenc);
+ /* well some idiot changed the _add function to do its own ref'ing for
+ no decent purpose whatsoever ... */
+ camel_object_unref((CamelObject *)charenc);
+ }
}
camel_stream_filter_add(filter_stream, filter);
camel_object_unref((CamelObject *)filter);