aboutsummaryrefslogtreecommitdiff
path: root/modules/base
diff options
context:
space:
mode:
author无闻 <u@gogs.io>2015-07-30 20:22:42 +0800
committer无闻 <u@gogs.io>2015-07-30 20:22:42 +0800
commiteedac7322984ecf8cbfc9fdc7d24a5be75efc6cc (patch)
tree831c6ee0fcb231eed3cb302f30ec7d834bd4d3fc /modules/base
parent869113704b7f8a8e8f173797d865c813b0e69a4a (diff)
parent2cc050e21ed35d95d824cc22d129fc22ee1318a4 (diff)
Merge pull request #1404 from wqweto/develop
Allow space and/or percent in file and directory names
Diffstat (limited to 'modules/base')
-rw-r--r--modules/base/template.go4
1 files changed, 2 insertions, 2 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)
}