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 | |
parent | 4917d29c121af221c3768871efabc5f99b88c4b8 (diff) |
Fix UTF-8 in upper-case, use ansi charset for all non UTF-8 encodings
Diffstat (limited to 'modules')
-rw-r--r-- | modules/base/template.go | 4 | ||||
-rw-r--r-- | modules/setting/setting.go | 2 |
2 files changed, 3 insertions, 3 deletions
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) } diff --git a/modules/setting/setting.go b/modules/setting/setting.go index 896e60ad..f826a3a4 100644 --- a/modules/setting/setting.go +++ b/modules/setting/setting.go @@ -313,7 +313,7 @@ func NewConfigContext() { RepoRootPath = path.Clean(RepoRootPath) } ScriptType = sec.Key("SCRIPT_TYPE").MustString("bash") - AnsiCharset = sec.Key("ANSI_CHARSET").MustString("ISO-8859-1") + AnsiCharset = sec.Key("ANSI_CHARSET").MustString("") // UI settings. IssuePagingNum = Cfg.Section("ui").Key("ISSUE_PAGING_NUM").MustInt(10) |