浏览代码

Set utf-8 charset for text files when serving raw content (#2898)

Tamás Molnár 9 年之前
父节点
当前提交
39356f4238
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      routers/repo/download.go

+ 1 - 1
routers/repo/download.go

@@ -29,7 +29,7 @@ func ServeData(ctx *context.Context, name string, reader io.Reader) error {
 			ctx.Resp.Header().Set("Content-Transfer-Encoding", "binary")
 		}
 	} else {
-		ctx.Resp.Header().Set("Content-Type", "text/plain")
+		ctx.Resp.Header().Set("Content-Type", "text/plain; charset=utf-8")
 	}
 	ctx.Resp.Write(buf)
 	_, err := io.Copy(ctx.Resp, reader)