From 2cc050e21ed35d95d824cc22d129fc22ee1318a4 Mon Sep 17 00:00:00 2001 From: Vladimir Vissoultchev Date: Wed, 29 Jul 2015 17:58:03 +0300 Subject: Fix UTF-8 in upper-case, use ansi charset for all non UTF-8 encodings --- modules/base/template.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'modules/base/template.go') diff --git a/modules/base/template.go b/modules/base/template.go index f0a2e032..2a81a34d 100644 --- a/modules/base/template.go +++ b/modules/base/template.go @@ -55,7 +55,7 @@ func ShortSha(sha1 string) string { func DetectEncoding(content []byte) (string, error) { detector := chardet.NewTextDetector() result, err := detector.DetectBest(content) - if result.Charset == "ISO-8859-1" { + if result.Charset != "UTF-8" && len(setting.AnsiCharset) > 0 { return setting.AnsiCharset, err } return result.Charset, err @@ -67,7 +67,7 @@ func ToUtf8WithErr(content []byte) (error, string) { return err, "" } - if charsetLabel == "utf8" { + if charsetLabel == "UTF-8" { return nil, string(content) } -- cgit v1.2.3