X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=notmuch-show.c;h=c7f13204d749e30be84d82791afeb2ebc5ba5770;hp=a21d223cd3f3e9ed669672316b170ea757be8a32;hb=d024ab4a046b0eb53bfdbb7eb9d5f25a52172271;hpb=268da2cf19e723c2787f39d30ab415dc42fc5bf9 diff --git a/notmuch-show.c b/notmuch-show.c index a21d223c..c7f13204 100644 --- a/notmuch-show.c +++ b/notmuch-show.c @@ -72,12 +72,19 @@ show_part_content (GMimeObject *part) GMimeStream *stream_stdout = g_mime_stream_file_new (stdout); GMimeStream *stream_filter = NULL; GMimeDataWrapper *wrapper; + const char *charset; + + charset = g_mime_object_get_content_type_parameter (part, "charset"); if (stream_stdout) { g_mime_stream_file_set_owner (GMIME_STREAM_FILE (stream_stdout), FALSE); stream_filter = g_mime_stream_filter_new(stream_stdout); g_mime_stream_filter_add(GMIME_STREAM_FILTER(stream_filter), g_mime_filter_crlf_new(FALSE, FALSE)); + if (charset) { + g_mime_stream_filter_add(GMIME_STREAM_FILTER(stream_filter), + g_mime_filter_charset_new(charset, "UTF-8")); + } } wrapper = g_mime_part_get_content_object (GMIME_PART (part)); @@ -220,7 +227,8 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[])) return 1; } - notmuch = notmuch_database_open (notmuch_config_get_database_path (config)); + notmuch = notmuch_database_open (notmuch_config_get_database_path (config), + NOTMUCH_DATABASE_MODE_READ_ONLY); if (notmuch == NULL) return 1;