From 126119c0b1a5dc1da11c930769c03ff0a7f33fa8 Mon Sep 17 00:00:00 2001 From: Reto Brunner Date: Sat, 4 Jan 2020 20:39:00 +0100 Subject: [PATCH] msgviewer: decode headers prior to displaying them --- widgets/msgviewer.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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