From d84ec2d32d0a1072aa23ebbc335b74a364265d3a Mon Sep 17 00:00:00 2001 From: Kevin McCarthy Date: Sun, 23 Oct 2016 15:11:56 -0700 Subject: [PATCH] Perform charset conversion on text attachments when piping. (closes #3773) (see #3886) MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit When piping a text attachment, there is no reliable way to know the charset used. Vincent Lefèvre says: It was decided in the past that when there is no information on the charset in a transmission to an external command (e.g. as for mail composing), texts are expected to be transmitted in the local charset. Add a MUTT_CHARSET flag to enable charset conversion on text attachments for both when $attach_split is set and unset. --- attach.c | 2 ++ recvattach.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/attach.c b/attach.c index d50d54a44..e11a82c80 100644 --- a/attach.c +++ b/attach.c @@ -620,6 +620,8 @@ int mutt_pipe_attachment (FILE *fp, BODY *b, const char *path, char *outfile) STATE s; memset (&s, 0, sizeof (STATE)); + /* perform charset conversion on text attachments when piping */ + s.flags = MUTT_CHARCONV; if (outfile && *outfile) thepid = mutt_create_filter_fd (path, &s.fpout, NULL, NULL, -1, out, -1); diff --git a/recvattach.c b/recvattach.c index 39a26c0bd..86ecdffca 100644 --- a/recvattach.c +++ b/recvattach.c @@ -672,6 +672,8 @@ void mutt_pipe_attachment_list (FILE *fp, int tag, BODY *top, int filter) buf[0] = 0; memset (&state, 0, sizeof (STATE)); + /* perform charset conversion on text attachments when piping */ + state.flags = MUTT_CHARCONV; if (mutt_get_field ((filter ? _("Filter through: ") : _("Pipe to: ")), buf, sizeof (buf), MUTT_CMD) != 0 || !buf[0]) -- 2.40.0