From 5cfde572dd74f6596b0303eb31f8fdcec13fff52 Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Wed, 24 Aug 2022 12:41:34 +0200 Subject: Set charset to UTF-8 --- mpaste.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mpaste.go b/mpaste.go index 16a1cef..c306878 100644 --- a/mpaste.go +++ b/mpaste.go @@ -142,7 +142,7 @@ func syntaxHighlighting(w http.ResponseWriter, r *http.Request) { data, err := ioutil.ReadFile(filePrefix + removeExt(r.URL.Path[1:])) if err != nil { - w.Header().Set("Content-Type", "text/plain") + w.Header().Set("Content-Type", "text/plain; charset=utf-8") writeHeader(w, http.StatusNotFound, "") return } @@ -175,10 +175,10 @@ func endpoint(w http.ResponseWriter, r *http.Request) { writeHeader(w, http.StatusNotFound, "") return case urlSyntax: - w.Header().Set("Content-Type", "text/html") + w.Header().Set("Content-Type", "text/html; charset=utf-8") syntaxHighlighting(w, r) case urlValid: - w.Header().Set("Content-Type", "text/plain") + w.Header().Set("Content-Type", "text/plain; charset=utf-8") http.ServeFile(w, r, filePrefix+r.URL.Path[1:]) } case http.MethodPost: -- cgit v1.2.3