diff options
author | Vladimir Vissoultchev <wqweto@gmail.com> | 2015-07-29 17:58:03 +0300 |
---|---|---|
committer | Vladimir Vissoultchev <wqweto@gmail.com> | 2015-07-29 17:58:03 +0300 |
commit | 2cc050e21ed35d95d824cc22d129fc22ee1318a4 (patch) | |
tree | 6a6a17749a305325d8226f8b2950cfd0404860ef /modules/base | |
parent | 4917d29c121af221c3768871efabc5f99b88c4b8 (diff) | |
download | gitea-2cc050e21ed35d95d824cc22d129fc22ee1318a4.tar.gz gitea-2cc050e21ed35d95d824cc22d129fc22ee1318a4.zip |
Fix UTF-8 in upper-case, use ansi charset for all non UTF-8 encodings
Diffstat (limited to 'modules/base')
-rw-r--r-- | modules/base/template.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/modules/base/template.go b/modules/base/template.go index f0a2e0329c..2a81a34d26 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) } |