Fixed a bug where Japanese text wouldn't work properly with Gzip.

This commit is contained in:
Azareal 2018-08-22 21:02:50 +10:00
parent 90114fae9e
commit 80f103a3d3
1 changed files with 1 additions and 1 deletions

View File

@ -661,7 +661,7 @@ func (router *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) {
// Disable Gzip when SSL is disabled for security reasons? // Disable Gzip when SSL is disabled for security reasons?
if prefix != "/ws" && strings.Contains(req.Header.Get("Accept-Encoding"), "gzip") { if prefix != "/ws" && strings.Contains(req.Header.Get("Accept-Encoding"), "gzip") {
w.Header().Set("Content-Encoding", "gzip") w.Header().Set("Content-Encoding", "gzip")
w.Header().Set("Content-Type", "text/html") w.Header().Set("Content-Type", "text/html; charset=utf-8")
gz := gzip.NewWriter(w) gz := gzip.NewWriter(w)
defer func() { defer func() {
if w.Header().Get("Content-Encoding") == "gzip" { if w.Header().Get("Content-Encoding") == "gzip" {