diff options
author | 无闻 <u@gogs.io> | 2015-07-30 20:22:42 +0800 |
---|---|---|
committer | 无闻 <u@gogs.io> | 2015-07-30 20:22:42 +0800 |
commit | eedac7322984ecf8cbfc9fdc7d24a5be75efc6cc (patch) | |
tree | 831c6ee0fcb231eed3cb302f30ec7d834bd4d3fc /modules | |
parent | 869113704b7f8a8e8f173797d865c813b0e69a4a (diff) | |
parent | 2cc050e21ed35d95d824cc22d129fc22ee1318a4 (diff) |
Merge pull request #1404 from wqweto/develop
Allow space and/or percent in file and directory names
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) |