- if (stream_out) {
- stream_filter = g_mime_stream_filter_new (stream_out);
- g_mime_stream_filter_add(GMIME_STREAM_FILTER (stream_filter),
- g_mime_filter_crlf_new (FALSE, FALSE));
- if (charset) {
- GMimeFilter *charset_filter;
- charset_filter = g_mime_filter_charset_new (charset, "UTF-8");
- /* This result can be NULL for things like "unknown-8bit".
- * Don't set a NULL filter as that makes GMime print
- * annoying assertion-failure messages on stderr. */
- if (charset_filter)
- g_mime_stream_filter_add (GMIME_STREAM_FILTER (stream_filter),
- charset_filter);
- }
+ stream_filter = g_mime_stream_filter_new (stream_out);
+ g_mime_stream_filter_add(GMIME_STREAM_FILTER (stream_filter),
+ g_mime_filter_crlf_new (FALSE, FALSE));
+
+ charset = g_mime_object_get_content_type_parameter (part, "charset");
+ if (charset) {
+ GMimeFilter *charset_filter;
+ charset_filter = g_mime_filter_charset_new (charset, "UTF-8");
+ /* This result can be NULL for things like "unknown-8bit".
+ * Don't set a NULL filter as that makes GMime print
+ * annoying assertion-failure messages on stderr. */
+ if (charset_filter)
+ g_mime_stream_filter_add (GMIME_STREAM_FILTER (stream_filter),
+ charset_filter);