From 51fd6d0bb5705b9bc37c8dcd404cfa78796246e7 Mon Sep 17 00:00:00 2001 From: Lucas Hinderberger Date: Fri, 5 Jul 2024 09:30:42 +0200 Subject: [PATCH] SMTP GUI: Setting utf-8 charset --- internal/smtp/http.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/smtp/http.go b/internal/smtp/http.go index 51e6667..e727237 100644 --- a/internal/smtp/http.go +++ b/internal/smtp/http.go @@ -210,7 +210,7 @@ func (h *smtpHTTPHandler) handleContentBody(w http.ResponseWriter, r *http.Reque } func (h *smtpHTTPHandler) handleGUIIndex(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Content-Type", "text/html") + w.Header().Set("Content-Type", "text/html; charset=utf-8") err := guiIndexTemplate.Execute(w, map[string]any{"prefix": h.prefix}) if err != nil { @@ -219,8 +219,6 @@ func (h *smtpHTTPHandler) handleGUIIndex(w http.ResponseWriter, r *http.Request) } func (h *smtpHTTPHandler) handleGUIMessage(w http.ResponseWriter, r *http.Request, msg *ReceivedMessage) { - w.Header().Set("Content-Type", "text/html") - metadata := buildMessageFullMeta(msg) metadataJson, err := json.MarshalIndent(metadata, "", " ") if err != nil { @@ -231,6 +229,8 @@ func (h *smtpHTTPHandler) handleGUIMessage(w http.ResponseWriter, r *http.Reques return } + w.Header().Set("Content-Type", "text/html; charset=utf-8") + err = guiMessageTemplate.Execute(w, map[string]any{ "prefix": h.prefix, "metadata": metadata,