aboutsummaryrefslogtreecommitdiff
path: root/modules/base
diff options
context:
space:
mode:
author无闻 <u@gogs.io>2015-07-28 14:23:16 +0800
committer无闻 <u@gogs.io>2015-07-28 14:23:16 +0800
commit7d8121b0773c6844cfbe022f0897145cabeea3c1 (patch)
tree689353fd8012a041090c003d3307b57e5ca321e7 /modules/base
parent589618c8a53f11395fca3465d8ad936ad46caaf0 (diff)
parent53bcf373c1d076dd14db6aff0247ae9dbdc49c77 (diff)
Merge pull request #1399 from wqweto/develop
Allow explicit charset/codepage setting for ANSI source files to alle…
Diffstat (limited to 'modules/base')
-rw-r--r--modules/base/template.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/modules/base/template.go b/modules/base/template.go
index 1442bf0e..bc69bb3b 100644
--- a/modules/base/template.go
+++ b/modules/base/template.go
@@ -55,6 +55,9 @@ 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" {
+ return setting.AnsiCharset, err
+ }
return result.Charset, err
}