diff --git a/http_readers.go b/http_readers.go index f05271c..7870d3e 100644 --- a/http_readers.go +++ b/http_readers.go @@ -76,7 +76,7 @@ func handlerText(w http.ResponseWriter, rq *http.Request) { hyphaName := HyphaNameFromRq(rq, "text") if data, ok := HyphaStorage[hyphaName]; ok { log.Println("Serving", data.textPath) - w.Header().Set("Content-Type", "text/plain") + w.Header().Set("Content-Type", "text/plain; charset=utf-8") http.ServeFile(w, rq, data.textPath) } } diff --git a/mime.go b/mime.go index 73ecd21..c16eebe 100644 --- a/mime.go +++ b/mime.go @@ -27,17 +27,18 @@ func MimeToExtension(mime string) string { func ExtensionToMime(ext string) string { mm := map[string]string{ - "bin": "application/octet-stream", - "jpg": "image/jpeg", - "gif": "image/gif", - "png": "image/png", - "webp": "image/webp", - "svg": "image/svg+xml", - "ico": "image/x-icon", - "ogg": "application/ogg", - "webm": "video/webm", - "mp3": "audio/mp3", - "mp4": "video/mp4", + ".bin": "application/octet-stream", + ".jpg": "image/jpeg", + ".jpeg": "image/jpeg", + ".gif": "image/gif", + ".png": "image/png", + ".webp": "image/webp", + ".svg": "image/svg+xml", + ".ico": "image/x-icon", + ".ogg": "application/ogg", + ".webm": "video/webm", + ".mp3": "audio/mp3", + ".mp4": "video/mp4", } if mime, ok := mm[ext]; ok { return mime