about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorernierasta <ernierasta@zori.cz>2019-12-06 00:58:54 +0100
committerDrew DeVault <sir@cmpwn.com>2019-12-07 14:30:03 -0500
commit0a1a75aed17e56c32cb0283e1b9f1978bd52fd7f (patch)
tree3faa0126b20fa0e2e742963caa22999348395ac2
parentcd54bcd041afb744488a4b2047cd2a986d05d090 (diff)
downloadaerc-0a1a75aed17e56c32cb0283e1b9f1978bd52fd7f.tar.gz
fix non-utf8 encoding in msgviewer
This patch should fix encoding problem with non-utf8 text/plain mime.
It is now correctly convert to utf8 before sending to pager. It will
also solve quoting such mails.

Leszek
-rw-r--r--widgets/msgviewer.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/widgets/msgviewer.go b/widgets/msgviewer.go
index aca7dd4..9d71c3e 100644
--- a/widgets/msgviewer.go
+++ b/widgets/msgviewer.go
@@ -10,7 +10,7 @@ import (
 	"strings"
 
 	"github.com/danwakefield/fnmatch"
-	"github.com/emersion/go-message"
+	message "github.com/emersion/go-message"
 	_ "github.com/emersion/go-message/charset"
 	"github.com/emersion/go-message/mail"
 	"github.com/gdamore/tcell"
@@ -530,7 +530,7 @@ func (pv *PartViewer) attemptCopy() {
 	if pv.source != nil && pv.pager != nil && pv.pager.Process != nil {
 		header := message.Header{}
 		header.SetText("Content-Transfer-Encoding", pv.part.Encoding)
-		header.SetContentType(pv.part.MIMEType, pv.part.Params)
+		header.SetContentType(fmt.Sprintf("%s/%s", pv.part.MIMEType, pv.part.MIMESubType), pv.part.Params)
 		header.SetText("Content-Description", pv.part.Description)
 		if pv.filter != nil {
 			stdout, _ := pv.filter.StdoutPipe()