aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/attachment.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/attachment.go b/lib/attachment.go
index d7cbf3f7..9246315d 100644
--- a/lib/attachment.go
+++ b/lib/attachment.go
@@ -7,7 +7,9 @@ import (
"net/http"
"os"
"path/filepath"
+ "strings"
+ "git.sr.ht/~rjarry/aerc/logging"
"github.com/emersion/go-message/mail"
"github.com/pkg/errors"
)
@@ -134,3 +136,18 @@ func (pa *PartAttachment) WriteTo(w *mail.Writer) error {
}
return nil
}
+
+// SetUtf8Charset sets the charset in a params map to UTF-8.
+func SetUtf8Charset(origParams map[string]string) map[string]string {
+ params := make(map[string]string)
+ for k, v := range origParams {
+ switch strings.ToLower(k) {
+ case "charset":
+ logging.Infof("substitute charset %s with utf-8", v)
+ params[k] = "utf-8"
+ default:
+ params[k] = v
+ }
+ }
+ return params
+}