notmuch-reply: Display reply message part using UTF-8.
authorKan-Ru Chen <kanru@kanru.info>
Sat, 28 Nov 2009 11:58:29 +0000 (19:58 +0800)
committerCarl Worth <cworth@cworth.org>
Fri, 4 Dec 2009 00:47:47 +0000 (16:47 -0800)
Pass the message through the charset filter so that we can view
messages wrote in different charset encoding.

Signed-off-by: Kan-Ru Chen <kanru@kanru.info>
notmuch-reply.c

index 9ca1236b9c1791aec6d0ba88ba250e9773cf0689..0cda72dcf05488be170faca9bd9a6e63f6c3e054 100644 (file)
@@ -39,11 +39,17 @@ reply_part_content (GMimeObject *part)
 {
     GMimeStream *stream_stdout = NULL, *stream_filter = NULL;
     GMimeDataWrapper *wrapper;
 {
     GMimeStream *stream_stdout = NULL, *stream_filter = NULL;
     GMimeDataWrapper *wrapper;
+    const char *charset;
 
 
+    charset = g_mime_object_get_content_type_parameter (part, "charset");
     stream_stdout = g_mime_stream_file_new (stdout);
     if (stream_stdout) {
        g_mime_stream_file_set_owner (GMIME_STREAM_FILE (stream_stdout), FALSE);
        stream_filter = g_mime_stream_filter_new(stream_stdout);
     stream_stdout = g_mime_stream_file_new (stdout);
     if (stream_stdout) {
        g_mime_stream_file_set_owner (GMIME_STREAM_FILE (stream_stdout), FALSE);
        stream_filter = g_mime_stream_filter_new(stream_stdout);
+        if (charset) {
+          g_mime_stream_filter_add(GMIME_STREAM_FILTER(stream_filter),
+                                   g_mime_filter_charset_new(charset, "UTF-8"));
+        }
     }
     g_mime_stream_filter_add(GMIME_STREAM_FILTER(stream_filter),
                             g_mime_filter_reply_new(TRUE));
     }
     g_mime_stream_filter_add(GMIME_STREAM_FILTER(stream_filter),
                             g_mime_filter_reply_new(TRUE));