about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorReto Brunner <reto@labrat.space>2020-01-04 20:39:00 +0100
committerDrew DeVault <sir@cmpwn.com>2020-01-05 16:02:42 -0500
commit126119c0b1a5dc1da11c930769c03ff0a7f33fa8 (patch)
treec54492d8512108aecf2a2cf24cf24dfc2b3196f5
parentcb168682b3754e57e27d809e41d8c22bb56457af (diff)
downloadaerc-126119c0b1a5dc1da11c930769c03ff0a7f33fa8.tar.gz
msgviewer: decode headers prior to displaying them
-rw-r--r--widgets/msgviewer.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/widgets/msgviewer.go b/widgets/msgviewer.go
index ff3bcb0..cc883fc 100644
--- a/widgets/msgviewer.go
+++ b/widgets/msgviewer.go
@@ -590,8 +590,14 @@ func (pv *PartViewer) attemptCopy() {
 				// hence all writes in this block go directly to the pager
 				fields := pv.msg.RFC822Headers.Fields()
 				for fields.Next() {
+					var value string
+					var err error
+					if value, err = fields.Text(); err != nil {
+						// better than nothing, use the non decoded version
+						value = fields.Value()
+					}
 					field := fmt.Sprintf(
-						"%s: %s\n", fields.Key(), fields.Value())
+						"%s: %s\n", fields.Key(), value)
 					pv.pagerin.Write([]byte(field))
 				}
 				// virtual header