summaryrefslogtreecommitdiffstats
path: root/modules/base/template.go
diff options
context:
space:
mode:
authorVladimir Vissoultchev <wqweto@gmail.com>2015-07-27 21:58:51 +0300
committerVladimir Vissoultchev <wqweto@gmail.com>2015-07-27 21:58:51 +0300
commit53bcf373c1d076dd14db6aff0247ae9dbdc49c77 (patch)
tree15918b18d80d8310568d1d20c6223bb1ee231f7b /modules/base/template.go
parent31f6069dbe95cf54de50accca500e9fb95dd2f47 (diff)
downloadgitea-53bcf373c1d076dd14db6aff0247ae9dbdc49c77.tar.gz
gitea-53bcf373c1d076dd14db6aff0247ae9dbdc49c77.zip
Allow explicit charset/codepage setting for ANSI source files to alleviate issue #1088
Diffstat (limited to 'modules/base/template.go')
-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 1442bf0e84..bc69bb3b37 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
}